@sealcode/sealgen 0.4.2 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/forms/controls/checkboxed-list-input.d.ts +2 -2
- package/@types/forms/controls/controls.d.ts +1 -0
- package/@types/forms/controls/dropdown.d.ts +2 -2
- package/@types/forms/controls/editable-collection-subset.d.ts +2 -2
- package/@types/forms/controls/form-control.d.ts +2 -2
- package/@types/forms/controls/form-field-control.d.ts +2 -2
- package/@types/forms/controls/form-header.d.ts +4 -4
- package/@types/forms/controls/html.d.ts +9 -0
- package/@types/forms/controls/simple-input.d.ts +4 -2
- package/@types/forms/fields/checkboxed-list.d.ts +7 -7
- package/@types/forms/fields/collection-field.d.ts +3 -3
- package/@types/forms/fields/field.d.ts +6 -6
- package/@types/forms/fields/number.d.ts +3 -3
- package/@types/forms/fields/pick-from-list.d.ts +7 -7
- package/@types/forms/fields/simple-form-field.d.ts +2 -2
- package/@types/forms/form.d.ts +9 -9
- package/@types/index.d.ts +2 -2
- package/@types/make-hidden-inputs.d.ts +4 -3
- package/@types/page/access-control.d.ts +2 -2
- package/@types/page/list.d.ts +14 -14
- package/@types/page/mountable.d.ts +8 -8
- package/@types/page/page.d.ts +5 -5
- package/@types/page/props-parser.d.ts +4 -4
- package/@types/utils/get-prettier-config.d.ts +2 -0
- package/@types/utils/prettier.d.ts +2 -0
- package/@types/utils/translate.d.ts +2 -2
- package/@types/utils/url-with-new-params.d.ts +2 -2
- package/lib/build.js +3 -2
- package/lib/build.js.map +1 -1
- package/lib/forms/controls/checkboxed-list-input.js.map +1 -1
- package/lib/forms/controls/controls.js +3 -1
- package/lib/forms/controls/controls.js.map +1 -1
- package/lib/forms/controls/dropdown.js.map +1 -1
- package/lib/forms/controls/editable-collection-subset.js.map +1 -1
- package/lib/forms/controls/form-header.js.map +1 -1
- package/lib/forms/controls/html.js +19 -0
- package/lib/forms/controls/html.js.map +1 -0
- package/lib/forms/controls/simple-input.js +3 -1
- package/lib/forms/controls/simple-input.js.map +1 -1
- package/lib/forms/fields/checkboxed-list.js.map +1 -1
- package/lib/forms/fields/collection-field.js.map +1 -1
- package/lib/forms/fields/field.js.map +1 -1
- package/lib/forms/fields/number.js.map +1 -1
- package/lib/forms/fields/pick-from-list.js.map +1 -1
- package/lib/forms/fields/simple-form-field.js.map +1 -1
- package/lib/forms/form.js.map +1 -1
- package/lib/generate-collections.js +22 -1
- package/lib/generate-collections.js.map +1 -1
- package/lib/generate-routes.js +35 -11
- package/lib/generate-routes.js.map +1 -1
- package/lib/index.js +15 -2
- package/lib/index.js.map +1 -1
- package/lib/make-hidden-inputs.js.map +1 -1
- package/lib/page/access-control.js.map +1 -1
- package/lib/page/list.js.map +1 -1
- package/lib/page/mountable.js.map +1 -1
- package/lib/page/page.js.map +1 -1
- package/lib/page/props-parser.js.map +1 -1
- package/lib/templates/form.js +9 -16
- package/lib/templates/form.js.map +1 -1
- package/lib/templates/list.js +4 -4
- package/lib/templates/list.js.map +1 -1
- package/lib/templates/page.js +3 -3
- package/lib/templates/route-test.js +1 -1
- package/lib/templates/route-test.js.map +1 -1
- package/lib/utils/get-prettier-config.js +36 -0
- package/lib/utils/get-prettier-config.js.map +1 -0
- package/lib/utils/prettier.js +36 -0
- package/lib/utils/prettier.js.map +1 -0
- package/lib/utils/translate.js.map +1 -1
- package/lib/utils/url-with-new-params.js.map +1 -1
- package/package.json +4 -3
- package/src/build.ts +3 -2
- package/src/forms/controls/checkboxed-list-input.ts +2 -2
- package/src/forms/controls/controls.ts +1 -0
- package/src/forms/controls/dropdown.ts +2 -2
- package/src/forms/controls/editable-collection-subset.ts +2 -2
- package/src/forms/controls/form-control.ts +2 -2
- package/src/forms/controls/form-field-control.ts +2 -2
- package/src/forms/controls/form-header.ts +3 -3
- package/src/forms/controls/html.ts +18 -0
- package/src/forms/controls/simple-input.ts +6 -5
- package/src/forms/fields/checkboxed-list.ts +5 -5
- package/src/forms/fields/collection-field.ts +3 -3
- package/src/forms/fields/field.ts +6 -6
- package/src/forms/fields/number.ts +3 -3
- package/src/forms/fields/pick-from-list.ts +5 -5
- package/src/forms/fields/simple-form-field.ts +2 -2
- package/src/forms/form.ts +9 -9
- package/src/generate-collections.ts +3 -1
- package/src/generate-routes.ts +31 -13
- package/src/index.ts +2 -2
- package/src/make-hidden-inputs.ts +4 -3
- package/src/page/access-control.ts +2 -2
- package/src/page/list.ts +14 -23
- package/src/page/mountable.ts +9 -9
- package/src/page/page.ts +5 -5
- package/src/page/props-parser.ts +4 -7
- package/src/templates/form.ts +9 -16
- package/src/templates/list.ts +4 -4
- package/src/templates/page.ts +3 -3
- package/src/templates/route-test.ts +1 -1
- package/src/utils/prettier.ts +13 -0
- package/src/utils/translate.ts +2 -2
- package/src/utils/url-with-new-params.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import {
|
|
2
|
+
import { Context } from "koa";
|
|
3
3
|
import { ChekboxedListField } from "../fields/field";
|
|
4
4
|
import { FormDataValue } from "../form";
|
|
5
5
|
import { FormFieldControl } from "./controls";
|
|
@@ -11,5 +11,5 @@ export declare class CheckboxedListInput extends FormFieldControl {
|
|
|
11
11
|
constructor(field: ChekboxedListField, options?: {
|
|
12
12
|
label: string;
|
|
13
13
|
});
|
|
14
|
-
render(ctx:
|
|
14
|
+
render(ctx: Context, data: Record<string, FormDataValue>): Promise<import("stream").Readable>;
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import {
|
|
2
|
+
import { Context } from "koa";
|
|
3
3
|
import { FormField, PickFromListField } from "../fields/field";
|
|
4
4
|
import { FormDataValue } from "../form";
|
|
5
5
|
import { FormFieldControl } from "./controls";
|
|
@@ -15,5 +15,5 @@ export declare class Dropdown extends FormFieldControl {
|
|
|
15
15
|
autosubmit?: boolean;
|
|
16
16
|
autocomplete?: boolean;
|
|
17
17
|
});
|
|
18
|
-
render<Fields extends Record<string, FormField>>(ctx:
|
|
18
|
+
render<Fields extends Record<string, FormField>>(ctx: Context, data: Record<string, FormDataValue>): Promise<import("stream").Readable>;
|
|
19
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FlatTemplatable } from "tempstream";
|
|
3
3
|
import { PickFromListField } from "../fields/field";
|
|
4
4
|
import { FormDataValue } from "../form";
|
|
@@ -16,6 +16,6 @@ export declare class EditableCollectionSubset extends FormFieldControl {
|
|
|
16
16
|
listLabel?: string | undefined;
|
|
17
17
|
selectLabel?: string | undefined;
|
|
18
18
|
constructor(field: PickFromListField, actionname: string, listLabel?: string | undefined, selectLabel?: string | undefined);
|
|
19
|
-
render(ctx:
|
|
19
|
+
render(ctx: Context, data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
20
20
|
role: "input";
|
|
21
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FlatTemplatable } from "tempstream";
|
|
3
3
|
import { FormDataValue, FormMessage } from "../form";
|
|
4
4
|
export declare abstract class FormControl {
|
|
5
|
-
abstract render(ctx:
|
|
5
|
+
abstract render(ctx: Context, data: Record<string, FormDataValue>, messages: FormMessage[]): FlatTemplatable | Promise<FlatTemplatable>;
|
|
6
6
|
abstract role: "input" | "decoration" | "messages" | "submit";
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FlatTemplatable } from "tempstream";
|
|
3
3
|
import { FormField } from "../fields/field";
|
|
4
4
|
import { FieldValueType, FormDataValue } from "../form";
|
|
@@ -10,5 +10,5 @@ export declare abstract class FormFieldControl extends FormControl {
|
|
|
10
10
|
fields: FormField[];
|
|
11
11
|
role: "input";
|
|
12
12
|
constructor(fields: FormField[]);
|
|
13
|
-
abstract render(ctx:
|
|
13
|
+
abstract render(ctx: Context, data: Record<string, FormDataValue>): FlatTemplatable | Promise<FlatTemplatable>;
|
|
14
14
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FormControl } from "./controls";
|
|
3
3
|
export declare class FormHeader extends FormControl {
|
|
4
4
|
text: string;
|
|
5
|
-
isVisible: (ctx:
|
|
5
|
+
isVisible: (ctx: Context) => Promise<boolean>;
|
|
6
6
|
role: "decoration";
|
|
7
|
-
constructor(text: string, isVisible?: (ctx:
|
|
8
|
-
render(ctx:
|
|
7
|
+
constructor(text: string, isVisible?: (ctx: Context) => Promise<boolean>);
|
|
8
|
+
render(ctx: Context): Promise<string>;
|
|
9
9
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { FlatTemplatable } from "tempstream";
|
|
3
|
+
import { FormControl } from "./controls";
|
|
4
|
+
export declare class HTML extends FormControl {
|
|
5
|
+
renderer: ((ctx: Context) => FlatTemplatable) | string;
|
|
6
|
+
role: "decoration";
|
|
7
|
+
constructor(renderer: ((ctx: Context) => FlatTemplatable) | string);
|
|
8
|
+
render(ctx: Context): Promise<FlatTemplatable>;
|
|
9
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FormField } from "../fields/field";
|
|
3
3
|
import { FormDataValue } from "../form";
|
|
4
4
|
import { FormFieldControl } from "./controls";
|
|
@@ -8,6 +8,7 @@ export declare class SimpleInput extends FormFieldControl {
|
|
|
8
8
|
id?: string;
|
|
9
9
|
label?: string;
|
|
10
10
|
autocomplete?: boolean;
|
|
11
|
+
hide_errors?: boolean;
|
|
11
12
|
type?: "color" | "date" | "email" | "file" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
|
|
12
13
|
value?: string;
|
|
13
14
|
placeholder?: string;
|
|
@@ -18,11 +19,12 @@ export declare class SimpleInput extends FormFieldControl {
|
|
|
18
19
|
id?: string;
|
|
19
20
|
label?: string;
|
|
20
21
|
autocomplete?: boolean;
|
|
22
|
+
hide_errors?: boolean;
|
|
21
23
|
type?: "color" | "date" | "email" | "file" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
|
|
22
24
|
value?: string;
|
|
23
25
|
placeholder?: string;
|
|
24
26
|
readonly?: boolean;
|
|
25
27
|
step?: number;
|
|
26
28
|
});
|
|
27
|
-
render<Fields extends Record<string, FormField>>(ctx:
|
|
29
|
+
render<Fields extends Record<string, FormField>>(ctx: Context, data: Record<string, FormDataValue>): Promise<string>;
|
|
28
30
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FormDataValue } from "../form";
|
|
3
3
|
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field";
|
|
4
4
|
export declare class ChekboxedListField extends FormField<Record<string, "on">> {
|
|
5
5
|
required: boolean;
|
|
6
|
-
generateOptions: (ctx:
|
|
6
|
+
generateOptions: (ctx: Context) => Promise<Record<string, string> | {
|
|
7
7
|
[i: string]: string;
|
|
8
8
|
}>;
|
|
9
|
-
isVisible: (ctx:
|
|
10
|
-
constructor(required: boolean, generateOptions: (ctx:
|
|
9
|
+
isVisible: (ctx: Context) => Promise<boolean>;
|
|
10
|
+
constructor(required: boolean, generateOptions: (ctx: Context) => Promise<Record<string, string> | {
|
|
11
11
|
[i: string]: string;
|
|
12
|
-
}>, isVisible?: (ctx:
|
|
13
|
-
isValueValid(_:
|
|
14
|
-
parse(_:
|
|
12
|
+
}>, isVisible?: (ctx: Context) => Promise<boolean>);
|
|
13
|
+
isValueValid(_: Context, value: unknown): Promise<FormFieldValidationResponse>;
|
|
14
|
+
parse(_: Context, raw_value: FormDataValue): Promise<FieldParseResult<Record<string, "on">>>;
|
|
15
15
|
getEmptyValue(): Record<string, "on">;
|
|
16
16
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { Depromisify, Field, FieldOutput } from "sealious";
|
|
3
3
|
import { FormDataValue } from "../form";
|
|
4
4
|
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field";
|
|
5
5
|
export declare class CollectionField<F extends Field> extends FormField<FieldOutput<F>> {
|
|
6
6
|
sealiousField: F;
|
|
7
7
|
constructor(required: boolean, sealiousField: F);
|
|
8
|
-
parse(ctx:
|
|
9
|
-
isValueValid(ctx:
|
|
8
|
+
parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<FieldOutput<F>>>;
|
|
9
|
+
isValueValid(ctx: Context, value: FieldOutput<F>): Promise<FormFieldValidationResponse>;
|
|
10
10
|
getEmptyValue(): Depromisify<ReturnType<F["decode"]>>;
|
|
11
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FormDataValue } from "../form";
|
|
3
3
|
export declare type FormFieldValidationResponse = {
|
|
4
4
|
valid: boolean;
|
|
5
5
|
message: string;
|
|
6
6
|
};
|
|
7
|
-
export declare type FormFieldValidationFn<ValueType> = (ctx:
|
|
7
|
+
export declare type FormFieldValidationFn<ValueType> = (ctx: Context, value: ValueType, field: FormField<ValueType>) => Promise<FormFieldValidationResponse>;
|
|
8
8
|
export declare type FieldParsedValue<T> = T extends FormField<infer R> ? R : never;
|
|
9
9
|
export declare type FieldParseResult<T> = {
|
|
10
10
|
parsable: false;
|
|
@@ -20,11 +20,11 @@ export declare abstract class FormField<ParsedValue extends unknown = unknown> {
|
|
|
20
20
|
name: string;
|
|
21
21
|
constructor(required?: boolean);
|
|
22
22
|
init(fieldname: string): void;
|
|
23
|
-
_validate(ctx:
|
|
23
|
+
_validate(ctx: Context, value: ParsedValue): Promise<FormFieldValidationResponse>;
|
|
24
24
|
abstract getEmptyValue(): ParsedValue;
|
|
25
|
-
isValueValid(ctx:
|
|
26
|
-
abstract parse(ctx:
|
|
27
|
-
getValue(ctx:
|
|
25
|
+
isValueValid(ctx: Context, value: ParsedValue): Promise<FormFieldValidationResponse>;
|
|
26
|
+
abstract parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<ParsedValue>>;
|
|
27
|
+
getValue(ctx: Context, all_form_values: Record<string, FormDataValue>): Promise<{
|
|
28
28
|
valid: boolean;
|
|
29
29
|
message: string;
|
|
30
30
|
parsed: ParsedValue;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FormDataValue } from "../form";
|
|
3
3
|
import { FieldParseResult, FormField } from "./field";
|
|
4
4
|
export declare class NumberField<DefaultValue extends number | null = null> extends FormField<number | DefaultValue> {
|
|
5
5
|
default_value: DefaultValue;
|
|
6
6
|
constructor(required: boolean | undefined, default_value: DefaultValue);
|
|
7
|
-
isValueValid(_:
|
|
7
|
+
isValueValid(_: Context, value: unknown): Promise<{
|
|
8
8
|
valid: boolean;
|
|
9
9
|
message: string;
|
|
10
10
|
}>;
|
|
11
|
-
parse(_:
|
|
11
|
+
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<number>>;
|
|
12
12
|
getEmptyValue(): DefaultValue;
|
|
13
13
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FormFieldValidationResponse } from "./field";
|
|
3
3
|
import { SimpleFormField } from "./simple-form-field";
|
|
4
4
|
export declare class PickFromListField extends SimpleFormField {
|
|
5
5
|
required: boolean;
|
|
6
|
-
generateOptions: (ctx:
|
|
6
|
+
generateOptions: (ctx: Context) => Promise<Record<string, string> | {
|
|
7
7
|
[i: string]: string;
|
|
8
8
|
}>;
|
|
9
|
-
customValidation: (ctx:
|
|
10
|
-
constructor(required: boolean, generateOptions: (ctx:
|
|
9
|
+
customValidation: (ctx: Context, value: unknown, instance: PickFromListField) => Promise<FormFieldValidationResponse>;
|
|
10
|
+
constructor(required: boolean, generateOptions: (ctx: Context) => Promise<Record<string, string> | {
|
|
11
11
|
[i: string]: string;
|
|
12
|
-
}>, customValidation?: (ctx:
|
|
13
|
-
isValueValid(ctx:
|
|
14
|
-
valueInList(ctx:
|
|
12
|
+
}>, customValidation?: (ctx: Context, value: unknown, instance: PickFromListField) => Promise<FormFieldValidationResponse>);
|
|
13
|
+
isValueValid(ctx: Context, value: string): Promise<FormFieldValidationResponse>;
|
|
14
|
+
valueInList(ctx: Context, value: unknown): Promise<FormFieldValidationResponse>;
|
|
15
15
|
getEmptyValue(): string;
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldParseResult, FormField } from "./field";
|
|
2
2
|
import { FormDataValue } from "../form";
|
|
3
|
-
import {
|
|
3
|
+
import { Context } from "koa";
|
|
4
4
|
export declare class SimpleFormField extends FormField<string | null> {
|
|
5
|
-
parse(_:
|
|
5
|
+
parse(_: Context, raw_value: FormDataValue): Promise<FieldParseResult<string>>;
|
|
6
6
|
getEmptyValue(): string;
|
|
7
7
|
}
|
package/@types/forms/form.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="koa__router" />
|
|
2
|
-
import {
|
|
2
|
+
import { Context } from "koa";
|
|
3
3
|
import Router from "@koa/router";
|
|
4
4
|
import { FlatTemplatable } from "tempstream";
|
|
5
5
|
import { FormField } from "./fields/field";
|
|
@@ -21,17 +21,17 @@ export declare type FormData<Fieldnames extends string = string> = {
|
|
|
21
21
|
export declare abstract class Form<F extends Fields> extends Mountable<F> {
|
|
22
22
|
defaultSuccessMessage: string;
|
|
23
23
|
submitButtonText: string;
|
|
24
|
-
canAccess(_:
|
|
24
|
+
canAccess(_: Context): Promise<{
|
|
25
25
|
canAccess: boolean;
|
|
26
26
|
message: string;
|
|
27
27
|
}>;
|
|
28
|
-
renderError(_:
|
|
29
|
-
render(ctx:
|
|
28
|
+
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
29
|
+
render(ctx: Context, data: FormData): Promise<FlatTemplatable>;
|
|
30
30
|
makeFormTag(): FlatTemplatable;
|
|
31
|
-
onValuesInvalid(ctx:
|
|
32
|
-
onError(ctx:
|
|
33
|
-
abstract onSubmit(ctx:
|
|
34
|
-
onSuccess(ctx:
|
|
31
|
+
onValuesInvalid(ctx: Context, form_messages: FormMessage[]): Promise<void>;
|
|
32
|
+
onError(ctx: Context, data: FormData, error: unknown): Promise<void>;
|
|
33
|
+
abstract onSubmit(ctx: Context, data: FormData): void | Promise<void>;
|
|
34
|
+
onSuccess(ctx: Context, data: FormData): Promise<void>;
|
|
35
35
|
mount(router: Router, path: string): void;
|
|
36
|
-
extractRawValues(ctx:
|
|
36
|
+
extractRawValues(ctx: Context): Record<string, FormDataValue>;
|
|
37
37
|
}
|
package/@types/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ declare module "koa" {
|
|
|
7
7
|
$body: Record<string, FormDataValue>;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export * from "./forms/controls/controls";
|
|
11
|
-
export * from "./forms/fields/field";
|
|
10
|
+
export * as Controls from "./forms/controls/controls";
|
|
11
|
+
export * as Fields from "./forms/fields/field";
|
|
12
12
|
export * from "./page/mountable";
|
|
13
13
|
export * from "./page/page";
|
|
14
14
|
export * from "./forms/form";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FlatTemplatable } from "tempstream";
|
|
3
|
-
import { FormDataValue
|
|
4
|
-
|
|
3
|
+
import { FormDataValue } from ".";
|
|
4
|
+
import { FormField } from "./forms/fields/field";
|
|
5
|
+
export declare function makeHiddenInputs(ctx: Context, fields: Record<string, FormField>, values: Record<string, FormDataValue>, fields_to_skip: string[]): FlatTemplatable;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { ActionName, Collection } from "sealious";
|
|
3
|
-
export declare function peopleWhoCan(action: ActionName, collection: Collection): (ctx:
|
|
3
|
+
export declare function peopleWhoCan(action: ActionName, collection: Collection): (ctx: Context) => Promise<{
|
|
4
4
|
canAccess: boolean;
|
|
5
5
|
message: string;
|
|
6
6
|
}>;
|
package/@types/page/list.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { Collection, CollectionItem, ItemList } from "sealious";
|
|
3
3
|
import { Templatable, FlatTemplatable } from "tempstream";
|
|
4
4
|
import { Page } from "./page";
|
|
@@ -13,27 +13,27 @@ export declare const BaseListPageFields: {
|
|
|
13
13
|
readonly itemsPerPage: NumberField<12>;
|
|
14
14
|
};
|
|
15
15
|
export declare abstract class ListPage<ItemType, F extends typeof BaseListPageFields> extends Page<F> {
|
|
16
|
-
abstract getItems(ctx:
|
|
17
|
-
abstract getTotalPages(ctx:
|
|
18
|
-
abstract renderItem(ctx:
|
|
16
|
+
abstract getItems(ctx: Context, page: number, itemsPerPage: number, values: Record<string, FormDataValue>): Promise<ItemType[]>;
|
|
17
|
+
abstract getTotalPages(ctx: Context, itemsPerPage: number, values: Record<string, FormDataValue>): Promise<number>;
|
|
18
|
+
abstract renderItem(ctx: Context, item: ItemType): Promise<FlatTemplatable>;
|
|
19
19
|
filterFields: Record<string, FormField>;
|
|
20
20
|
filterControls: FormFieldControl[];
|
|
21
21
|
init(): void;
|
|
22
|
-
renderListContainer(_:
|
|
23
|
-
render(ctx:
|
|
24
|
-
renderPagination(ctx:
|
|
22
|
+
renderListContainer(_: Context, content: Templatable): FlatTemplatable;
|
|
23
|
+
render(ctx: Context): Promise<FlatTemplatable>;
|
|
24
|
+
renderPagination(ctx: Context, values: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
25
25
|
private renderPageButton;
|
|
26
|
-
getFilterValues(ctx:
|
|
27
|
-
renderFilters(ctx:
|
|
26
|
+
getFilterValues(ctx: Context): Promise<Record<string, unknown>>;
|
|
27
|
+
renderFilters(ctx: Context): FlatTemplatable;
|
|
28
28
|
}
|
|
29
29
|
export declare abstract class SealiousItemListPage<C extends Collection, F extends typeof BaseListPageFields> extends ListPage<CollectionItem<C>, F> {
|
|
30
30
|
collection: C;
|
|
31
31
|
constructor(collection: C);
|
|
32
|
-
getTotalPages(ctx:
|
|
33
|
-
protected addFilter(ctx:
|
|
34
|
-
getItems(ctx:
|
|
35
|
-
renderItem(_:
|
|
36
|
-
canAccess: (ctx:
|
|
32
|
+
getTotalPages(ctx: Context, itemsPerPage: number): Promise<number>;
|
|
33
|
+
protected addFilter(ctx: Context, list: ItemList<C>): Promise<void>;
|
|
34
|
+
getItems(ctx: Context, page: number, itemsPerPage: number): Promise<CollectionItem<C>[]>;
|
|
35
|
+
renderItem(_: Context, item: CollectionItem<C>): Promise<FlatTemplatable>;
|
|
36
|
+
canAccess: (ctx: Context) => Promise<{
|
|
37
37
|
canAccess: boolean;
|
|
38
38
|
message: string;
|
|
39
39
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="koa__router" />
|
|
2
2
|
import Router from "@koa/router";
|
|
3
3
|
import { FormControl } from "../forms/controls/form-control";
|
|
4
|
-
import {
|
|
4
|
+
import { Context } from "koa";
|
|
5
5
|
import { FlatTemplatable } from "tempstream";
|
|
6
6
|
import { FormField } from "../forms/fields/field";
|
|
7
7
|
import { FormData, FormDataValue, FormMessage } from "../forms/form";
|
|
@@ -15,22 +15,22 @@ export declare abstract class Mountable<F extends Fields = Fields> {
|
|
|
15
15
|
constructor();
|
|
16
16
|
abstract controls: FormControl[];
|
|
17
17
|
abstract mount(router: Router, path: string): void;
|
|
18
|
-
abstract canAccess(ctx:
|
|
18
|
+
abstract canAccess(ctx: Context): Promise<{
|
|
19
19
|
canAccess: boolean;
|
|
20
20
|
message: string;
|
|
21
21
|
}>;
|
|
22
|
-
abstract renderError(ctx:
|
|
23
|
-
abstract extractRawValues(ctx:
|
|
24
|
-
validateValues(ctx:
|
|
22
|
+
abstract renderError(ctx: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
23
|
+
abstract extractRawValues(ctx: Context): Record<string, FormDataValue>;
|
|
24
|
+
validateValues(ctx: Context, data: Record<string, FormDataValue>): Promise<{
|
|
25
25
|
valid: boolean;
|
|
26
26
|
error: string;
|
|
27
27
|
}>;
|
|
28
|
-
protected validate(ctx:
|
|
28
|
+
protected validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
|
|
29
29
|
valid: boolean;
|
|
30
30
|
field_errors: Partial<Record<keyof Fields, string>>;
|
|
31
31
|
form_messages: FormMessage[];
|
|
32
32
|
}>;
|
|
33
33
|
init(): void;
|
|
34
|
-
renderControls(ctx:
|
|
35
|
-
renderMessages(_:
|
|
34
|
+
renderControls(ctx: Context, data: FormData<keyof Fields>): FlatTemplatable;
|
|
35
|
+
renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
|
|
36
36
|
}
|
package/@types/page/page.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="koa__router" />
|
|
2
2
|
import Router from "@koa/router";
|
|
3
|
-
import {
|
|
3
|
+
import { Context } from "koa";
|
|
4
4
|
import { FlatTemplatable } from "tempstream";
|
|
5
5
|
import { FormDataValue } from "../forms/form";
|
|
6
6
|
import { Fields, Mountable, PageErrorMessage } from "./mountable";
|
|
@@ -9,11 +9,11 @@ export declare abstract class Page<F extends Fields = Record<string, never>> ext
|
|
|
9
9
|
propsParser: PagePropsParser<Record<keyof Fields, unknown>>;
|
|
10
10
|
controls: never[];
|
|
11
11
|
mount(router: Router, path: string): void;
|
|
12
|
-
canAccess(_:
|
|
12
|
+
canAccess(_: Context): Promise<{
|
|
13
13
|
canAccess: boolean;
|
|
14
14
|
message: string;
|
|
15
15
|
}>;
|
|
16
|
-
renderError(_:
|
|
17
|
-
abstract render(ctx:
|
|
18
|
-
extractRawValues(ctx:
|
|
16
|
+
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
17
|
+
abstract render(ctx: Context): Promise<FlatTemplatable>;
|
|
18
|
+
extractRawValues(ctx: Context): Record<string, FormDataValue>;
|
|
19
19
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { FormData, FormDataValue } from "..";
|
|
3
3
|
import { BasePageProps } from "./list";
|
|
4
4
|
export declare type EncodedProps = Record<string, unknown>;
|
|
5
5
|
export declare abstract class PagePropsParser<PropsType> {
|
|
6
|
-
abstract decode(ctx:
|
|
6
|
+
abstract decode(ctx: Context): Record<string, FormDataValue>;
|
|
7
7
|
abstract encode(props: Record<string, FormData>): EncodedProps;
|
|
8
8
|
abstract getHTMLInputName(prop_name: string): string;
|
|
9
|
-
overwriteProp(ctx:
|
|
9
|
+
overwriteProp(ctx: Context, new_props: Partial<PropsType>): EncodedProps;
|
|
10
10
|
}
|
|
11
11
|
export declare class AllQueryParams<PropsType extends BasePageProps> extends PagePropsParser<PropsType> {
|
|
12
|
-
decode(ctx:
|
|
12
|
+
decode(ctx: Context): Record<string, FormDataValue>;
|
|
13
13
|
encode(props: PropsType): Record<string, unknown>;
|
|
14
14
|
getHTMLInputName(prop_name: string): string;
|
|
15
15
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "koa";
|
|
2
2
|
import { Translation } from "sealious";
|
|
3
|
-
export declare function t(ctx:
|
|
3
|
+
export declare function t(ctx: Context, key: string, props: any[], default_translation: Translation): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function UrlWithNewParams(ctx:
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
export declare function UrlWithNewParams(ctx: Context, query_params: Record<string, unknown>): string;
|
package/lib/build.js
CHANGED
|
@@ -43,7 +43,7 @@ async function build_ts() {
|
|
|
43
43
|
outdir: "./dist/back",
|
|
44
44
|
logLevel: "info",
|
|
45
45
|
platform: "node",
|
|
46
|
-
target: "
|
|
46
|
+
target: "es2022",
|
|
47
47
|
format: "cjs",
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -72,7 +72,8 @@ async function complex_build(watch) {
|
|
|
72
72
|
}
|
|
73
73
|
if (path.endsWith(".ts") &&
|
|
74
74
|
!path.endsWith("src/back/collections.ts") &&
|
|
75
|
-
!path.endsWith("src/back/routes/routes.ts")
|
|
75
|
+
!path.endsWith("src/back/routes/routes.ts") &&
|
|
76
|
+
!path.endsWith("src/back/routes/urls.ts")) {
|
|
76
77
|
await build_ts();
|
|
77
78
|
console.log(`Finished TS build [on ${path}]`);
|
|
78
79
|
}
|
package/lib/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA6C;AAC7C,6DAAiD;AACjD,mDAAqC;AACrC,0DAA4C;AAC5C,6DAA4D;AAC5D,yCAAsC;AACtC,iEAA6D;AAC7D,uDAAmD;AAEnD,KAAK,UAAU,QAAQ;IACtB,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACvC,mBAAI,CAAC,oBAAoB,CAAC;QAC1B,0CAAmB,EAAE;QACrB,gCAAc,EAAE;KAChB,CAAC,CAAC;IACH,MAAM,eAAK,CAAC;QACX,WAAW;QACX,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,KAAK;KACb,CAAC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,UAAU,GAAuB,IAAI,CAAC;IAC1C,IAAI,KAAK,EAAE;QACV,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,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACzB,MAAM,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;KAC5B;AACF,CAAC;AAlBD,oCAkBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkboxed-list-input.js","sourceRoot":"","sources":["../../../src/forms/controls/checkboxed-list-input.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAEzD,2CAAwC;AAGxC,yCAA8C;AAE9C,MAAa,mBAAoB,SAAQ,2BAAgB;IACxD,YACQ,KAAyB,EACzB,UAA6B,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE;QAEzD,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAHR,UAAK,GAAL,KAAK,CAAoB;QACzB,YAAO,GAAP,OAAO,CAA2C;IAG1D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"checkboxed-list-input.js","sourceRoot":"","sources":["../../../src/forms/controls/checkboxed-list-input.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAEzD,2CAAwC;AAGxC,yCAA8C;AAE9C,MAAa,mBAAoB,SAAQ,2BAAgB;IACxD,YACQ,KAAyB,EACzB,UAA6B,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE;QAEzD,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAHR,UAAK,GAAL,KAAK,CAAoB;QACzB,YAAO,GAAP,OAAO,CAA2C;IAG1D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAmC;QAC7D,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACtE,IAAI,CAAC,kBAAE,CAAC,YAAY,EAAE,0BAAU,CAAC,KAAK,CAAC,0BAAU,CAAC,MAAM,CAAC,CAAC,EAAE;YAC3D,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC5D;QACD,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC;SACzB,CAAC,CAAC;QACH,OAAO,uBAAU,CAAA,UAAU,CAAC,GAAG,SAAS;YACvC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAC3B,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC;;;aAGtB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK;eACtB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK;SAC9B,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;;oBAElC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,KAAK,IAAI;YACzC,CACN;YACH,CAAC,CAAC,EAAE,EAAE,CAAC;IACT,CAAC;CACD;AA/BD,kDA+BC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormParagraph = exports.FormHeader = exports.SimpleInput = exports.Dropdown = exports.CheckboxedListInput = exports.Frame = exports.EditableCollectionSubset = exports.FormFieldControl = exports.FormControl = void 0;
|
|
3
|
+
exports.HTML = exports.FormParagraph = exports.FormHeader = exports.SimpleInput = exports.Dropdown = exports.CheckboxedListInput = exports.Frame = exports.EditableCollectionSubset = exports.FormFieldControl = exports.FormControl = void 0;
|
|
4
4
|
var form_control_1 = require("./form-control");
|
|
5
5
|
Object.defineProperty(exports, "FormControl", { enumerable: true, get: function () { return form_control_1.FormControl; } });
|
|
6
6
|
var form_field_control_1 = require("./form-field-control");
|
|
@@ -19,4 +19,6 @@ var form_header_1 = require("./form-header");
|
|
|
19
19
|
Object.defineProperty(exports, "FormHeader", { enumerable: true, get: function () { return form_header_1.FormHeader; } });
|
|
20
20
|
var form_paragraph_1 = require("./form-paragraph");
|
|
21
21
|
Object.defineProperty(exports, "FormParagraph", { enumerable: true, get: function () { return form_paragraph_1.FormParagraph; } });
|
|
22
|
+
var html_1 = require("./html");
|
|
23
|
+
Object.defineProperty(exports, "HTML", { enumerable: true, get: function () { return html_1.HTML; } });
|
|
22
24
|
//# sourceMappingURL=controls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../../../src/forms/controls/controls.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,2EAAwE;AAA/D,sIAAA,wBAAwB,OAAA;AACjC,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA;AAC5B,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
|
|
1
|
+
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../../../src/forms/controls/controls.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,2EAAwE;AAA/D,sIAAA,wBAAwB,OAAA;AACjC,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA;AAC5B,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,+BAA8B;AAArB,4FAAA,IAAI,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../src/forms/controls/dropdown.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AAGxC,yCAA8C;AAE9C,MAAa,QAAS,SAAQ,2BAAgB;IAC7C,YACQ,KAAwB,EACxB,UAIH;QACH,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,IAAI;KAClB;QAED,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAXR,UAAK,GAAL,KAAK,CAAmB;QACxB,YAAO,GAAP,OAAO,CAQb;IAGF,CAAC;IAED,KAAK,CAAC,MAAM,CACX,
|
|
1
|
+
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../src/forms/controls/dropdown.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AAGxC,yCAA8C;AAE9C,MAAa,QAAS,SAAQ,2BAAgB;IAC7C,YACQ,KAAwB,EACxB,UAIH;QACH,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,IAAI;KAClB;QAED,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAXR,UAAK,GAAL,KAAK,CAAmB;QACxB,YAAO,GAAP,OAAO,CAQb;IAGF,CAAC;IAED,KAAK,CAAC,MAAM,CACX,GAAY,EACZ,IAAmC;QAEnC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACtE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAC3B,OAAO,uBAAU,CAAA,UAAU,CAAC,eAAe,EAAE;OACxC,IAAI,CAAC,OAAO,CAAC,KAAK;;YAEb,IAAI,CAAC,KAAK,CAAC,IAAI;UACjB,EAAE;MACN,IAAI,CAAC,OAAO,CAAC,UAAU;YACxB,CAAC,CAAC,+BAA+B;YACjC,CAAC,CAAC,EAAE;MACH,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE;;MAEtD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CACtD,CAAC,OAAO,EAAE,EAAE,CACX,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAC1B,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CACjB,kBAAkB,KAAK,KACtB,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,YAAY;YAC5B,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,EACJ,IAAI,IAAI,WAAW,CACpB,CACF;aACQ,CAAC;IACb,CAAC;CACD;AA7CD,4BA6CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable-collection-subset.js","sourceRoot":"","sources":["../../../src/forms/controls/editable-collection-subset.ts"],"names":[],"mappings":";;;AACA,2CAAyD;AAGzD,yCAA8C;AAE9C;;;;;;GAMG;AACH,MAAa,wBAAyB,SAAQ,2BAAgB;IAC7D,YACQ,KAAwB,EACxB,UAAkB,EAClB,SAAkB,EAClB,WAAoB;QAE3B,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QALR,UAAK,GAAL,KAAK,CAAmB;QACxB,eAAU,GAAV,UAAU,CAAQ;QAClB,cAAS,GAAT,SAAS,CAAS;QAClB,gBAAW,GAAX,WAAW,CAAS;QA0E5B,SAAI,GAAU,OAAO,CAAC;IAvEtB,CAAC;IAED,KAAK,CAAC,MAAM,CACX,
|
|
1
|
+
{"version":3,"file":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,CAAC,CAAC,EAAE;;;;SAIR,CACD,CACH;;iCAE4B,GAAG,CAAC,IAAI;oBACrB,IAAI,CAAC,KAAK,CAAC,IAAI;OAC5B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CACtD,CAAC,OAAO,EAAE,EAAE,CACX,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;aACrB,MAAM,CACN,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CACX,CAAC,CAAC,MAAM,IAAK,EAAe,CAAC,CAAC,QAAQ,CACrC,KAAK,CACL,CACF;aACA,GAAG,CACH,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CACjB,kBAAkB,KAAK,KAAK,IAAI,WAAW,CAC5C,CACH;;iCAE2B,IAAI,CAAC,UAAU;;;OAGzC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,EAAE;;;SAGnD,CAAC;IACT,CAAC;CAED;AAhFD,4DAgFC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-header.js","sourceRoot":"","sources":["../../../src/forms/controls/form-header.ts"],"names":[],"mappings":";;;AACA,yCAAyC;AAEzC,MAAa,UAAW,SAAQ,sBAAW;IAE1C,YACQ,IAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"form-header.js","sourceRoot":"","sources":["../../../src/forms/controls/form-header.ts"],"names":[],"mappings":";;;AACA,yCAAyC;AAEzC,MAAa,UAAW,SAAQ,sBAAW;IAE1C,YACQ,IAAY,EACZ,YAAgD,KAAK,IAAI,EAAE,CAAC,IAAI;QAEvE,KAAK,EAAE,CAAC;QAHD,SAAI,GAAJ,IAAI,CAAQ;QACZ,cAAS,GAAT,SAAS,CAAuD;QAHxE,SAAI,GAAU,YAAY,CAAC;IAM3B,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,GAAY;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,CAAC;CACD;AAZD,gCAYC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HTML = void 0;
|
|
4
|
+
const controls_1 = require("./controls");
|
|
5
|
+
class HTML extends controls_1.FormControl {
|
|
6
|
+
constructor(renderer) {
|
|
7
|
+
super();
|
|
8
|
+
this.renderer = renderer;
|
|
9
|
+
this.role = "decoration";
|
|
10
|
+
}
|
|
11
|
+
async render(ctx) {
|
|
12
|
+
if (typeof this.renderer === "string") {
|
|
13
|
+
return this.renderer;
|
|
14
|
+
}
|
|
15
|
+
return this.renderer(ctx);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.HTML = HTML;
|
|
19
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/forms/controls/html.ts"],"names":[],"mappings":";;;AAEA,yCAAyC;AAEzC,MAAa,IAAK,SAAQ,sBAAW;IAGpC,YAAmB,QAAsD;QACxE,KAAK,EAAE,CAAC;QADU,aAAQ,GAAR,QAAQ,CAA8C;QAFzE,SAAI,GAAU,YAAY,CAAC;IAI3B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAY;QACxB,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAC;SACrB;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACD;AAbD,oBAaC"}
|
|
@@ -36,7 +36,9 @@ class SimpleInput extends controls_1.FormFieldControl {
|
|
|
36
36
|
${!this.options.autocomplete ? `autocomplete="off"` : ""}
|
|
37
37
|
${this.options.step ? `step="${this.options.step}"` : ""}
|
|
38
38
|
/>
|
|
39
|
-
${~valid
|
|
39
|
+
${~valid && !this.options.hide_errors
|
|
40
|
+
? `<div class="input__error">${message}</div>`
|
|
41
|
+
: ""}
|
|
40
42
|
</div>`;
|
|
41
43
|
}
|
|
42
44
|
}
|