@sealcode/sealgen 0.12.5 → 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/package.json +3 -3
- package/src/forms/fields/file.ts +1 -1
- package/src/forms/form.test.ts +2 -1
- 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,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import Router from "@koa/router";
|
|
4
|
-
import
|
|
4
|
+
import Sealious from "sealious";
|
|
5
5
|
import { Context } from "koa";
|
|
6
6
|
import { FlatTemplatable } from "tempstream";
|
|
7
7
|
import { MultipleFiles as MultipleFilesField } from "../fields/multiple-files.js";
|
|
@@ -10,7 +10,7 @@ import { FormControlContext } from "./form-control.js";
|
|
|
10
10
|
export type MultipleFilesOptions = {
|
|
11
11
|
label?: string;
|
|
12
12
|
uploadLabel?: string;
|
|
13
|
-
getAdditionalFields: (ctx: Context, file:
|
|
13
|
+
getAdditionalFields: (ctx: Context, file: Sealious.File) => Promise<Record<string, unknown>>;
|
|
14
14
|
};
|
|
15
15
|
export declare class MultipleFiles extends FormFieldControl {
|
|
16
16
|
field: MultipleFilesField;
|
|
@@ -19,18 +19,18 @@ export declare class MultipleFiles extends FormFieldControl {
|
|
|
19
19
|
getClassModifiers(): string[];
|
|
20
20
|
mount(router: Router): void;
|
|
21
21
|
deleteFileAssociation(ctx: Context, file_item_id: string): Promise<void>;
|
|
22
|
-
addFileAssociation(ctx: Context, file:
|
|
22
|
+
addFileAssociation(ctx: Context, file: Sealious.File): Promise<void>;
|
|
23
23
|
getFrameRelativeURL(): string;
|
|
24
24
|
getFrameID(): string;
|
|
25
25
|
renderFrame(ctx: Context, content?: FlatTemplatable): import("stream").Readable;
|
|
26
26
|
render(fctx: FormControlContext): FlatTemplatable | Promise<FlatTemplatable>;
|
|
27
|
-
getReferencingCollection(): Collection;
|
|
28
|
-
getFileField():
|
|
29
|
-
extractFileFromItem(item: CollectionItem): Promise<
|
|
30
|
-
renderFileItemPreview(_fileItem: CollectionItem, file:
|
|
31
|
-
renderFileItem(fileItem: CollectionItem, file:
|
|
32
|
-
renderFileRemoveButton(fileItem: CollectionItem): FlatTemplatable;
|
|
33
|
-
getFileItems(ctx: Context): Promise<CollectionItem<any>[]>;
|
|
27
|
+
getReferencingCollection(): Sealious.Collection;
|
|
28
|
+
getFileField(): Sealious.Field | null;
|
|
29
|
+
extractFileFromItem(item: Sealious.CollectionItem): Promise<Sealious.File | null>;
|
|
30
|
+
renderFileItemPreview(_fileItem: Sealious.CollectionItem, file: Sealious.File): Promise<FlatTemplatable>;
|
|
31
|
+
renderFileItem(fileItem: Sealious.CollectionItem, file: Sealious.File): Promise<FlatTemplatable>;
|
|
32
|
+
renderFileRemoveButton(fileItem: Sealious.CollectionItem): FlatTemplatable;
|
|
33
|
+
getFileItems(ctx: Context): Promise<Sealious.CollectionItem<any>[]>;
|
|
34
34
|
getInputAttributes(): {
|
|
35
35
|
type: string;
|
|
36
36
|
name: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Context } from "koa";
|
|
2
|
-
import
|
|
2
|
+
import Sealious from "sealious";
|
|
3
3
|
import { FormDataValue } from "../form-types.js";
|
|
4
4
|
import { FieldParseResult, FormField } from "./field.js";
|
|
5
5
|
export type FileContainer = {
|
|
6
|
-
old:
|
|
7
|
-
new:
|
|
6
|
+
old: Sealious.File | null;
|
|
7
|
+
new: Sealious.File | null;
|
|
8
8
|
};
|
|
9
9
|
export declare class File<Required extends boolean> extends FormField<Required, FileContainer> {
|
|
10
10
|
parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<FileContainer>>;
|
|
11
|
-
getDatabaseValue(ctx: Context, data: Record<string, FormDataValue>): Promise<
|
|
11
|
+
getDatabaseValue(ctx: Context, data: Record<string, FormDataValue>): Promise<Sealious.File | undefined>;
|
|
12
12
|
getEmptyValue(): {
|
|
13
13
|
old: null;
|
|
14
14
|
new: null;
|
package/@types/src/index.d.ts
CHANGED
|
@@ -8,12 +8,11 @@ declare module "koa" {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export * as Controls from "./forms/controls/controls.js";
|
|
11
|
-
export *
|
|
11
|
+
export * from "./forms/fields/field.js";
|
|
12
12
|
export * as Fields from "./forms/fields/fields.js";
|
|
13
13
|
export * from "./page/mountable.js";
|
|
14
14
|
export * from "./page/page.js";
|
|
15
15
|
export * from "./page/stateful-page.js";
|
|
16
|
-
export * from "./forms/form-types.js";
|
|
17
16
|
export * from "./forms/form.js";
|
|
18
17
|
export * from "./page/props-parser.js";
|
|
19
18
|
export * from "./utils/utils.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import Router from "@koa/router";
|
|
3
3
|
import { Context } from "koa";
|
|
4
4
|
import { FlatTemplatable } from "tempstream";
|
|
5
|
-
import type { FormDataValue } from "../
|
|
5
|
+
import type { FormDataValue } from "../forms/form-types.js";
|
|
6
6
|
import { Fields, MountableWithFields, PageErrorMessage } from "./mountable-with-fields.js";
|
|
7
7
|
import { PagePropsParser } from "./props-parser.js";
|
|
8
8
|
export declare abstract class Page<F extends Fields = Record<string, never>> extends MountableWithFields<F> {
|
|
@@ -40,7 +40,7 @@ class File extends FormField {
|
|
|
40
40
|
raw_value,
|
|
41
41
|
"new",
|
|
42
42
|
predicates.array(predicates.object)
|
|
43
|
-
) && raw_value.new[0] instanceof
|
|
43
|
+
) && raw_value.new[0] instanceof Sealious.File ? raw_value.new[0] : null;
|
|
44
44
|
result = {
|
|
45
45
|
parsable: true,
|
|
46
46
|
error: null,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealcode/sealgen",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.6",
|
|
4
4
|
"description": "Module to automate adding routes and collections to a sealious application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "node ./build.js",
|
|
9
9
|
"typecheck": "tsc --noemit",
|
|
10
|
-
"prepare": "npm run build",
|
|
10
|
+
"prepare": "rm -rf @types && npm run typecheck && tsc --emitDeclarationOnly && npm run build",
|
|
11
11
|
"watch": "npm run build -- --watch",
|
|
12
12
|
"test-cmd": "vitest --config ./src/vitest.config.ts",
|
|
13
13
|
"test-cmd-once": "vitest run --config ./src/vitest.config.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vitest": "^1.1.0",
|
|
49
49
|
"wait-port": "^1.0.4"
|
|
50
50
|
},
|
|
51
|
-
"types": "./@types/index.d.ts",
|
|
51
|
+
"types": "./@types/src/index.d.ts",
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@koa/router": "^12.0.1",
|
|
54
54
|
"@sealcode/ts-predicates": "^0.4.3",
|
package/src/forms/fields/file.ts
CHANGED
|
@@ -65,7 +65,7 @@ export class File<Required extends boolean> extends FormField<
|
|
|
65
65
|
raw_value,
|
|
66
66
|
"new",
|
|
67
67
|
predicates.array(predicates.object)
|
|
68
|
-
) && raw_value.new[0] instanceof
|
|
68
|
+
) && raw_value.new[0] instanceof Sealious.File
|
|
69
69
|
? raw_value.new[0]
|
|
70
70
|
: null;
|
|
71
71
|
result = {
|
package/src/forms/form.test.ts
CHANGED
|
@@ -3,11 +3,12 @@ import { describe, it, beforeAll, afterAll, afterEach, beforeEach } from "vitest
|
|
|
3
3
|
import axios from "axios";
|
|
4
4
|
import Koa, { BaseContext } from "koa";
|
|
5
5
|
import { Page } from "playwright";
|
|
6
|
-
import { Controls, Fields, Form,
|
|
6
|
+
import { Controls, Fields, Form, Mountable } from "../index.js";
|
|
7
7
|
import { mount } from "../mount.js";
|
|
8
8
|
import { locator_is_visible } from "../test_utils/locator_is_visible.js";
|
|
9
9
|
import { getBrowser } from "../utils/browser-creator.js";
|
|
10
10
|
import { assertThrowsAsync } from "../utils/utils.js";
|
|
11
|
+
import { FormDataValue } from "./form-types.js";
|
|
11
12
|
|
|
12
13
|
const fields = {
|
|
13
14
|
text: new Fields.SimpleFormField(true),
|
package/src/page/page.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Router from "@koa/router";
|
|
|
2
2
|
import { Context } from "koa";
|
|
3
3
|
|
|
4
4
|
import { FlatTemplatable, tempstream } from "tempstream";
|
|
5
|
-
import type { FormDataValue } from "../
|
|
5
|
+
import type { FormDataValue } from "../forms/form-types.js";
|
|
6
6
|
import {
|
|
7
7
|
Fields,
|
|
8
8
|
MountableWithFields,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function addCollection(): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function addJDDComponent(): Promise<void>;
|
package/@types/add-route.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/@types/build.d.ts
DELETED
package/@types/cli.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { FlatTemplatable } from "tempstream";
|
|
3
|
-
export declare function toggleModal(options: {
|
|
4
|
-
name: string;
|
|
5
|
-
contentWrapped: (id: string) => FlatTemplatable | Promise<FlatTemplatable>;
|
|
6
|
-
contentUnwrapped: (id: string) => FlatTemplatable | Promise<FlatTemplatable>;
|
|
7
|
-
}): import("stream").Readable;
|
package/@types/example.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generate_css_includes(): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateScssIncludes(): Promise<void>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
3
|
-
import Router from "@koa/router";
|
|
4
|
-
import { Context } from "koa";
|
|
5
|
-
import { Field, FieldsetOutput } from "sealious";
|
|
6
|
-
import { FormField, StructuredArrayField } from "../fields/field.js";
|
|
7
|
-
import { FormDataValue } from "../form.js";
|
|
8
|
-
import { FormControl } from "./controls.js";
|
|
9
|
-
import { FormControlContext } from "./form-control.js";
|
|
10
|
-
import { FormFieldControl } from "./form-field-control.js";
|
|
11
|
-
export type UnboundControlStorage<F extends {
|
|
12
|
-
new (...args: any): FormFieldControl;
|
|
13
|
-
} = {
|
|
14
|
-
new (...args: any): FormFieldControl;
|
|
15
|
-
}> = [F, string, ConstructorParameters<F>];
|
|
16
|
-
export declare function UnboundControl<F extends {
|
|
17
|
-
new (...args: any): FormFieldControl;
|
|
18
|
-
}>(controlClass: F, arbitrary_field_name: string, params: ConstructorParameters<F>["1"]): UnboundControlStorage;
|
|
19
|
-
export declare class StructuredArray<Subfields extends Record<string, Field>> extends FormFieldControl {
|
|
20
|
-
field: StructuredArrayField<Subfields>;
|
|
21
|
-
item_controls: Array<FormControl | UnboundControlStorage>;
|
|
22
|
-
constructor(field: StructuredArrayField<Subfields>, item_controls: Array<FormControl | UnboundControlStorage>);
|
|
23
|
-
getFrameID(): string;
|
|
24
|
-
getInnerFormID(): string;
|
|
25
|
-
getActionURL(form_id?: string, action?: Record<string, unknown>): string;
|
|
26
|
-
getDefaultItemBody(): Promise<{}>;
|
|
27
|
-
makeSubfield(_field_name: string): FormField;
|
|
28
|
-
renderItemControl(ctx: Context, form_id: string, control: FormControl | UnboundControlStorage, item: FieldsetOutput<Subfields>, index: number): Promise<(string | number | import("stream").Readable | null) | (string | number | import("stream").Readable | null)[] | Promise<string | number | import("stream").Readable | null>[]>;
|
|
29
|
-
renderItem(ctx: Context, form_id: string, item: FieldsetOutput<Subfields>, index: number): Promise<import("stream").Readable>;
|
|
30
|
-
getItems(ctx: Context, raw_values: Record<string, FormDataValue>): Promise<FieldsetOutput<Subfields>[]>;
|
|
31
|
-
_render(ctx: Context, form_id: string, raw_values: Record<string, FormDataValue>): Promise<import("stream").Readable>;
|
|
32
|
-
render(fctx: FormControlContext): Promise<import("stream").Readable>;
|
|
33
|
-
getTargetItemID(ctx: Context): Promise<string>;
|
|
34
|
-
mount(router: Router): void;
|
|
35
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { PickFromListField } from "../fields/pick-from-list.js";
|
|
3
|
-
import { FormControlContext } from "./form-control.js";
|
|
4
|
-
import { SimpleInput } from "./simple-input.js";
|
|
5
|
-
export declare class Autocomplete extends SimpleInput<string | null> {
|
|
6
|
-
field: PickFromListField<boolean>;
|
|
7
|
-
options: {
|
|
8
|
-
id?: string;
|
|
9
|
-
label?: string;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
};
|
|
12
|
-
constructor(field: PickFromListField<boolean>, options: {
|
|
13
|
-
id?: string;
|
|
14
|
-
label?: string;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
});
|
|
17
|
-
getListID(): string;
|
|
18
|
-
getInputAttributes(fctx: FormControlContext): Promise<{
|
|
19
|
-
list: string;
|
|
20
|
-
}>;
|
|
21
|
-
postInput(ctx: Context): Promise<string>;
|
|
22
|
-
}
|
|
@@ -1,14 +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 BigRadioGroup extends FormFieldControl {
|
|
6
|
-
field: FormField;
|
|
7
|
-
options: Record<string, {
|
|
8
|
-
description: FlatTemplatable | ((fctx: FormControlContext) => FlatTemplatable);
|
|
9
|
-
}>;
|
|
10
|
-
constructor(field: FormField, options: Record<string, {
|
|
11
|
-
description: FlatTemplatable | ((fctx: FormControlContext) => FlatTemplatable);
|
|
12
|
-
}>);
|
|
13
|
-
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
14
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { EnumMultipleField, FormField } from "../fields/field.js";
|
|
3
|
-
import { CheckboxWithValue } from "./checkbox.js";
|
|
4
|
-
import { FormFieldControl } from "./controls.js";
|
|
5
|
-
import { FormControlContext } from "./form-control.js";
|
|
6
|
-
export type DefaultCheckboxOptions = {
|
|
7
|
-
id?: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
hide_errors?: boolean;
|
|
10
|
-
readonly?: boolean;
|
|
11
|
-
name?: string;
|
|
12
|
-
checkboxNameToLabel?: (name: string) => string;
|
|
13
|
-
classes?: string[];
|
|
14
|
-
};
|
|
15
|
-
export declare class CheckboxGroup<Options extends DefaultCheckboxOptions = DefaultCheckboxOptions> extends FormFieldControl {
|
|
16
|
-
field: EnumMultipleField<readonly string[], boolean>;
|
|
17
|
-
options: Options;
|
|
18
|
-
constructor(field: EnumMultipleField<readonly string[], boolean>, options?: Options);
|
|
19
|
-
wrapGroup(fctx: FormControlContext, checkboxes: CheckboxWithValue[]): Promise<FlatTemplatable>;
|
|
20
|
-
render<Fields extends Record<string, FormField>>(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
21
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../form.js";
|
|
3
|
-
import { Tickable, TickableOptions } from "./tickable.js";
|
|
4
|
-
import { FormField } from "../fields/field.js";
|
|
5
|
-
export declare class Checkbox extends Tickable<boolean> {
|
|
6
|
-
type: "checkbox";
|
|
7
|
-
isChecked(_ctx: Context, _data: Record<string, FormDataValue>, value: boolean): boolean;
|
|
8
|
-
getValueAttribute(): string;
|
|
9
|
-
}
|
|
10
|
-
export declare class CheckboxWithValue extends Checkbox {
|
|
11
|
-
field: FormField<boolean, boolean>;
|
|
12
|
-
value: string;
|
|
13
|
-
constructor(field: FormField<boolean, boolean>, options: TickableOptions, value: string);
|
|
14
|
-
getValueAttribute(): string;
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { ChekboxedListField } from "../fields/field.js";
|
|
3
|
-
import { FormFieldControl } from "./controls.js";
|
|
4
|
-
import { FormControlContext } from "./form-control.js";
|
|
5
|
-
export declare class CheckboxedListInput extends FormFieldControl {
|
|
6
|
-
field: ChekboxedListField<boolean>;
|
|
7
|
-
options: {
|
|
8
|
-
label: string;
|
|
9
|
-
};
|
|
10
|
-
constructor(field: ChekboxedListField<boolean>, options?: {
|
|
11
|
-
label: string;
|
|
12
|
-
});
|
|
13
|
-
render(fctx: FormControlContext): Promise<import("stream").Readable>;
|
|
14
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { CheckboxWithValue } from "./checkbox.js";
|
|
3
|
-
import { CheckboxGroup, DefaultCheckboxOptions } from "./checkbox-group.js";
|
|
4
|
-
import { FormControlContext } from "./form-control.js";
|
|
5
|
-
export declare class CollapsibleCheckboxGroup extends CheckboxGroup<DefaultCheckboxOptions & {
|
|
6
|
-
textWhenOpen?: string;
|
|
7
|
-
textWhenClosed?: string;
|
|
8
|
-
groupID?: string;
|
|
9
|
-
}> {
|
|
10
|
-
wrapGroup(fctx: FormControlContext, checkboxes: CheckboxWithValue[]): Promise<FlatTemplatable>;
|
|
11
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { FieldGroup } from "./field-group.js";
|
|
3
|
-
import { FormControl } from "./form-control.js";
|
|
4
|
-
type CollapsibleFieldGroupOptions = {
|
|
5
|
-
label?: string;
|
|
6
|
-
classes?: string[];
|
|
7
|
-
openOnStart?: boolean;
|
|
8
|
-
textWhenOpen?: string;
|
|
9
|
-
textWhenClosed?: string;
|
|
10
|
-
groupID?: string;
|
|
11
|
-
};
|
|
12
|
-
export declare class CollapsibleFieldGroup extends FieldGroup {
|
|
13
|
-
controls: FormControl[];
|
|
14
|
-
options: CollapsibleFieldGroupOptions;
|
|
15
|
-
collapseID: string;
|
|
16
|
-
constructor(controls: FormControl[], options?: CollapsibleFieldGroupOptions);
|
|
17
|
-
getGroupLabelProps(): string;
|
|
18
|
-
preLabelContainer(): FlatTemplatable;
|
|
19
|
-
postLabel(): FlatTemplatable;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export { FormControl } from "./form-control.js";
|
|
2
|
-
export { FormFieldControl } from "./form-field-control.js";
|
|
3
|
-
export { EditableCollectionSubset } from "./editable-collection-subset.js";
|
|
4
|
-
export { Frame } from "./frame.js";
|
|
5
|
-
export { CheckboxedListInput } from "./checkboxed-list-input.js";
|
|
6
|
-
export * from "./dropdown.js";
|
|
7
|
-
export { SimpleInput } from "./simple-input.js";
|
|
8
|
-
export { FormHeader } from "./form-header.js";
|
|
9
|
-
export { FormParagraph } from "./form-paragraph.js";
|
|
10
|
-
export { HTML } from "./html.js";
|
|
11
|
-
export { HiddenInput } from "./hidden-input.js";
|
|
12
|
-
export { Textarea } from "./textarea.js";
|
|
13
|
-
export { FieldGroup } from "./field-group.js";
|
|
14
|
-
export * from "./derived.js";
|
|
15
|
-
export * from "./derived-frame.js";
|
|
16
|
-
export * from "./tickable.js";
|
|
17
|
-
export * from "./checkbox.js";
|
|
18
|
-
export * from "./radio.js";
|
|
19
|
-
export * from "./big-radio-group.js";
|
|
20
|
-
export * from "./checkbox-group.js";
|
|
21
|
-
export * from "./collapsible-field-group.js";
|
|
22
|
-
export * from "./collapsible-checkbox-group.js";
|
|
23
|
-
export * from "./autocomplete.js";
|
|
24
|
-
export * from "./file.js";
|
|
25
|
-
export * from "./photo.js";
|
|
26
|
-
export * from "./multiple-files.js";
|
|
27
|
-
export * from "./number.js";
|
|
28
|
-
export * from "./multiple-photos.js";
|
|
29
|
-
export * from "./array.js";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
4
|
-
import Router from "@koa/router";
|
|
5
|
-
import { Context } from "koa";
|
|
6
|
-
import { ParsedUrlQuery } from "querystring";
|
|
7
|
-
import { FlatTemplatable } from "tempstream";
|
|
8
|
-
import { FormField } from "../fields/field.js";
|
|
9
|
-
import { Derived } from "./derived.js";
|
|
10
|
-
import { FormControlContext } from "./form-control.js";
|
|
11
|
-
export declare class DerivedFrame extends Derived<{
|
|
12
|
-
frame_id: string;
|
|
13
|
-
form_id: string;
|
|
14
|
-
field_name_prefix: string;
|
|
15
|
-
}> {
|
|
16
|
-
frame_name: string;
|
|
17
|
-
generateFrameContent: (ctx: FormControlContext, args: ParsedUrlQuery) => Promise<FlatTemplatable>;
|
|
18
|
-
frame_id: string;
|
|
19
|
-
constructor(frame_name: string, fields: FormField[], generateFrameContent: (ctx: FormControlContext, args: ParsedUrlQuery) => Promise<FlatTemplatable>, frame_id?: string);
|
|
20
|
-
renderBackendResponseFrame(_ctx: Context, content: FlatTemplatable): import("stream").Readable;
|
|
21
|
-
mount(router: Router): void;
|
|
22
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { FormField } from "../fields/field.js";
|
|
3
|
-
import { FormDataValue } from "../form.js";
|
|
4
|
-
import { FormControl, FormControlContext } from "./form-control.js";
|
|
5
|
-
export declare class Derived<Consts extends Record<string, unknown | undefined>> extends FormControl {
|
|
6
|
-
fields: FormField[];
|
|
7
|
-
_render: (values: Record<string, string>, consts: Consts) => Promise<FlatTemplatable>;
|
|
8
|
-
getConsts: (fctx: FormControlContext) => Promise<Consts>;
|
|
9
|
-
role: "decoration";
|
|
10
|
-
constructor(fields: FormField[], _render: (values: Record<string, string>, consts: Consts) => Promise<FlatTemplatable>, getConsts?: (fctx: FormControlContext) => Promise<Consts>);
|
|
11
|
-
getBackendValues(fctx: FormControlContext): Promise<Record<string, FormDataValue>>;
|
|
12
|
-
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
13
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FlatTemplatable } from "tempstream";
|
|
3
|
-
import { FormField, PickFromListField } from "../fields/field.js";
|
|
4
|
-
import { FormDataValue } from "../form.js";
|
|
5
|
-
import { FormControlContext } from "./form-control.js";
|
|
6
|
-
import { SimpleInput } from "./simple-input.js";
|
|
7
|
-
export type DropdownOptions = {
|
|
8
|
-
label: string;
|
|
9
|
-
autosubmit?: boolean;
|
|
10
|
-
autocomplete?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export type DropdownOption = {
|
|
13
|
-
value: string;
|
|
14
|
-
label: string;
|
|
15
|
-
};
|
|
16
|
-
export declare class FreeformDropdown extends SimpleInput<string | null> {
|
|
17
|
-
field: FormField<boolean, string | null>;
|
|
18
|
-
_generateOptions: (ctx: Context) => Promise<DropdownOption[]>;
|
|
19
|
-
options: DropdownOptions;
|
|
20
|
-
constructor(field: FormField<boolean, string | null>, _generateOptions: (ctx: Context) => Promise<DropdownOption[]>, options?: DropdownOptions);
|
|
21
|
-
generateOptions(ctx: Context): Promise<DropdownOption[]>;
|
|
22
|
-
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
23
|
-
renderInput(ctx: Context, attributes_str: string, data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
24
|
-
}
|
|
25
|
-
export declare class Dropdown extends FreeformDropdown {
|
|
26
|
-
field: PickFromListField<boolean>;
|
|
27
|
-
options: DropdownOptions;
|
|
28
|
-
constructor(field: PickFromListField<boolean>, options?: DropdownOptions);
|
|
29
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { PickFromListField } from "../fields/field.js";
|
|
3
|
-
import { FormFieldControl } from "./controls.js";
|
|
4
|
-
import { FormControlContext } from "./form-control.js";
|
|
5
|
-
/**
|
|
6
|
-
* This control has own forms in it so if you want to use it you
|
|
7
|
-
* probably shouldn't use `await super.render(ctx, data, path)` in
|
|
8
|
-
* render method of you from implementation and you should write
|
|
9
|
-
* your own implementation of this method. See forms that uses
|
|
10
|
-
* this control for reference.
|
|
11
|
-
*/
|
|
12
|
-
export declare class EditableCollectionSubset extends FormFieldControl {
|
|
13
|
-
field: PickFromListField<false>;
|
|
14
|
-
actionname: string;
|
|
15
|
-
listLabel?: string | undefined;
|
|
16
|
-
selectLabel?: string | undefined;
|
|
17
|
-
constructor(field: PickFromListField<false>, actionname: string, listLabel?: string | undefined, selectLabel?: string | undefined);
|
|
18
|
-
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
19
|
-
role: "input";
|
|
20
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { FormControl, FormControlContext } from "./form-control.js";
|
|
3
|
-
import { FormFieldControl } from "./form-field-control.js";
|
|
4
|
-
export declare class FieldGroup extends FormFieldControl {
|
|
5
|
-
controls: FormControl[];
|
|
6
|
-
options: {
|
|
7
|
-
label?: string;
|
|
8
|
-
classes?: string[];
|
|
9
|
-
containerID?: string;
|
|
10
|
-
};
|
|
11
|
-
constructor(controls: FormControl[], options?: {
|
|
12
|
-
label?: string;
|
|
13
|
-
classes?: string[];
|
|
14
|
-
containerID?: string;
|
|
15
|
-
});
|
|
16
|
-
preLabel(): FlatTemplatable;
|
|
17
|
-
preLabelContainer(): FlatTemplatable;
|
|
18
|
-
postLabel(): FlatTemplatable;
|
|
19
|
-
preFields(): FlatTemplatable;
|
|
20
|
-
postFields(): FlatTemplatable;
|
|
21
|
-
getGroupLabelProps(): FlatTemplatable;
|
|
22
|
-
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
23
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { Context } from "koa";
|
|
3
|
-
import { FlatTemplatable } from "tempstream";
|
|
4
|
-
import { FileContainer } from "../fields/file.js";
|
|
5
|
-
import { FormDataValue } from "../form.js";
|
|
6
|
-
import { FormControlContext } from "./form-control.js";
|
|
7
|
-
import { SimpleInput } from "./simple-input.js";
|
|
8
|
-
export declare class File extends SimpleInput<FileContainer> {
|
|
9
|
-
getType(): string;
|
|
10
|
-
renderFilePreview(_ctx: Context, file_data: {
|
|
11
|
-
id?: string;
|
|
12
|
-
filename?: string;
|
|
13
|
-
} | null): Promise<FlatTemplatable>;
|
|
14
|
-
preInput(ctx: Context, data: Record<string, FormDataValue>): Promise<import("stream").Readable>;
|
|
15
|
-
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
16
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
|
-
import Router from "@koa/router";
|
|
3
|
-
import { Context } from "koa";
|
|
4
|
-
import { FlatTemplatable } from "tempstream";
|
|
5
|
-
import { FormDataValue, FormMessage } from "../form.js";
|
|
6
|
-
export declare class FormControlContext {
|
|
7
|
-
ctx: Context;
|
|
8
|
-
data: Record<string, FormDataValue>;
|
|
9
|
-
messages: FormMessage[];
|
|
10
|
-
field_name_prefix: string;
|
|
11
|
-
form_id: string;
|
|
12
|
-
validate: boolean;
|
|
13
|
-
constructor(ctx: Context, data: Record<string, FormDataValue>, messages: FormMessage[], field_name_prefix: string, form_id: string, validate: boolean);
|
|
14
|
-
}
|
|
15
|
-
export declare abstract class FormControl {
|
|
16
|
-
abstract render(fctx: FormControlContext): FlatTemplatable | Promise<FlatTemplatable>;
|
|
17
|
-
abstract role: "input" | "decoration" | "messages" | "submit";
|
|
18
|
-
mount(router: Router): void;
|
|
19
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { FormField } from "../fields/field.js";
|
|
3
|
-
import { FieldValueType } from "../form.js";
|
|
4
|
-
import { FormControl, FormControlContext } from "./form-control.js";
|
|
5
|
-
export type FormFieldsToTypes<FormFields extends readonly FormField[]> = {
|
|
6
|
-
[Index in keyof FormFields]: FormFields[Index] extends FormField ? FieldValueType<FormFields[Index]> : never;
|
|
7
|
-
};
|
|
8
|
-
export declare abstract class FormFieldControl extends FormControl {
|
|
9
|
-
fields: FormField[];
|
|
10
|
-
role: "input";
|
|
11
|
-
constructor(fields: FormField[]);
|
|
12
|
-
abstract render(fctx: FormControlContext): FlatTemplatable | Promise<FlatTemplatable>;
|
|
13
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FormControl } from "./controls.js";
|
|
2
|
-
import { FormControlContext } from "./form-control.js";
|
|
3
|
-
export declare class FormHeader extends FormControl {
|
|
4
|
-
text: string;
|
|
5
|
-
isVisible: (fctx: FormControlContext) => Promise<boolean>;
|
|
6
|
-
role: "decoration";
|
|
7
|
-
constructor(text: string, isVisible?: (fctx: FormControlContext) => Promise<boolean>);
|
|
8
|
-
render(fctx: FormControlContext): Promise<string>;
|
|
9
|
-
}
|
|
@@ -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
|
-
}
|