@sealcode/sealgen 0.19.16 → 0.19.18
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/app-config/get-app-port.d.ts +1 -0
- package/@types/app-config/load-app-config.d.ts +4 -0
- package/@types/app-config/resolve-app-config-path.d.ts +1 -0
- package/@types/controllers/sealgen-table.stimulus.d.ts +9 -0
- package/@types/forms/controls/table.d.ts +2 -0
- package/@types/forms/fields/structured-array.d.ts +2 -2
- package/@types/utils/translate.d.ts +2 -1
- package/lib/controllers/sealgen-table.stimulus.js +98 -0
- package/lib/forms/controls/table.js +49 -43
- package/lib/forms/controls/tickable.js +1 -3
- package/lib/forms/fields/collection-field.js +2 -1
- package/lib/generate-routes.js +23 -1
- package/lib/mount.js +8 -10
- package/lib/utils/translate.js +4 -4
- package/package.json +2 -2
- package/src/controllers/sealgen-table.stimulus.ts +115 -0
- package/src/forms/controls/table.ts +94 -81
- package/src/forms/fields/collection-field.ts +2 -1
- package/src/forms/fields/structured-array.ts +2 -11
- package/src/generate-routes.ts +38 -9
- package/src/mount.ts +8 -12
- package/.xunit +0 -75
- package/@types/add-verbose-crud.d.ts +0 -3
- package/@types/builders/colors-builder.d.sync-conflict-20250918-184323-TFDLWFG.ts +0 -10
- package/@types/builders/fonts-builder.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -7
- package/@types/controllers/table-add-button.d.ts +0 -6
- package/@types/crud-field-snippets.d.ts +0 -1
- package/@types/find-css-includes.d.ts +0 -1
- package/@types/forms/controls/array.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -33
- package/@types/forms/controls/array.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -33
- package/@types/forms/controls/autocomplete.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -22
- package/@types/forms/controls/checkbox-group.d.sync-conflict-20250918-184319-TFDLWFG.ts +0 -21
- package/@types/forms/controls/checkboxed-list-input.d.sync-conflict-20250918-184323-TFDLWFG.ts +0 -21
- package/@types/forms/controls/derived-frame.d.sync-conflict-20250918-184314-TFDLWFG.ts +0 -19
- package/@types/forms/controls/dropdown.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -30
- package/@types/forms/controls/file.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -13
- package/@types/forms/controls/form-control.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -19
- package/@types/forms/controls/form-control.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -19
- package/@types/forms/controls/multiple-files.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -42
- package/@types/forms/controls/multiple-photos.d.ts +0 -19
- package/@types/forms/controls/number.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -13
- package/@types/forms/controls/photo.d.sync-conflict-20250918-184321-TFDLWFG.ts +0 -19
- package/@types/forms/controls/photo.d.ts +0 -19
- package/@types/forms/controls/photo.test.d.ts +0 -1
- package/@types/forms/controls/reverse-single-reference.d.ts +0 -1
- package/@types/forms/controls/simple-input.d.sync-conflict-20250918-184310-TFDLWFG.ts +0 -33
- package/@types/forms/controls/simple-input.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -33
- package/@types/forms/controls/simple-input.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -33
- package/@types/forms/controls/table.d.sync-conflict-20250918-184302-TFDLWFG.ts +0 -39
- package/@types/forms/controls/table.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -39
- package/@types/forms/controls/textarea.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -25
- package/@types/forms/fields/boolean.d.sync-conflict-20250918-184325-TFDLWFG.ts +0 -22
- package/@types/forms/fields/boolean.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -22
- package/@types/forms/fields/checkboxed-list.d.sync-conflict-20250918-184325-TFDLWFG.ts +0 -23
- package/@types/forms/fields/collection-field.d.sync-conflict-20250918-184319-TFDLWFG.ts +0 -22
- package/@types/forms/fields/collection-field.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -22
- package/@types/forms/fields/coordinates.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -14
- package/@types/forms/fields/datetime.d.sync-conflict-20250918-222050-TFDLWFG.ts +0 -4
- package/@types/forms/fields/email.d.sync-conflict-20250918-184303-TFDLWFG.ts +0 -8
- package/@types/forms/fields/enum-multiple-sealious.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -16
- 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/field.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -70
- package/@types/forms/fields/fields.d.sync-conflict-20250918-184314-TFDLWFG.ts +0 -29
- package/@types/forms/fields/file.d.sync-conflict-20250918-184310-TFDLWFG.ts +0 -23
- package/@types/forms/fields/file.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -23
- package/@types/forms/fields/file.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -23
- package/@types/forms/fields/get-field-for-sealious.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -29
- package/@types/forms/fields/get-field-for-sealious.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -29
- package/@types/forms/fields/image.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -5
- package/@types/forms/fields/multiple-files.d.sync-conflict-20250918-184304-TFDLWFG.ts +0 -16
- package/@types/forms/fields/number.d.sync-conflict-20250918-184317-TFDLWFG.ts +0 -25
- package/@types/forms/fields/number.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -25
- package/@types/forms/fields/pick-from-list.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -15
- package/@types/forms/fields/proxy-field.d.sync-conflict-20250918-184307-TFDLWFG.ts +0 -15
- package/@types/forms/fields/regexp.d.sync-conflict-20250918-184305-TFDLWFG.ts +0 -21
- package/@types/forms/fields/regexp.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -21
- package/@types/forms/fields/regexp.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -21
- package/@types/forms/fields/reverse-single-reference.d.ts +0 -13
- package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-184309-TFDLWFG.ts +0 -29
- package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -29
- package/@types/forms/fields/simple-form-field.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -29
- package/@types/forms/fields/single-reference.sync-conflict-20250918-222043-TFDLWFG.d.ts +0 -10
- package/@types/forms/fields/structured-array.d.sync-conflict-20250918-184302-TFDLWFG.ts +0 -27
- package/@types/forms/fields/structured-array.d.sync-conflict-20250918-222049-TFDLWFG.ts +0 -27
- package/@types/forms/fields/structured-array.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -27
- package/@types/forms/fields/table.d.sync-conflict-20250918-184303-TFDLWFG.ts +0 -16
- package/@types/forms/form-types.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -26
- package/@types/forms/form.d.sync-conflict-20250918-184315-TFDLWFG.ts +0 -32
- package/@types/forms/form.d.sync-conflict-20250918-222049-TFDLWFG.ts +0 -32
- package/@types/forms/form.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -33
- package/@types/forms/form.test.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -6
- package/@types/forms/form.test.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -6
- package/@types/forms/multiform.d.sync-conflict-20250918-184308-TFDLWFG.ts +0 -23
- package/@types/forms/multiform.sync-conflict-20250918-222044-TFDLWFG.d.ts +0 -23
- package/@types/index.d.sync-conflict-20250918-184316-TFDLWFG.ts +0 -46
- package/@types/mount.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -6
- package/@types/page/list.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -48
- package/@types/page/list.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -48
- package/@types/page/list.sync-conflict-20250918-222048-TFDLWFG.d.ts +0 -48
- package/@types/page/mountable-with-fields.d.sync-conflict-20250918-184321-TFDLWFG.ts +0 -42
- package/@types/page/mountable-with-fields.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -42
- package/@types/page/mountable-with-fields.sync-conflict-20250918-222044-TFDLWFG.d.ts +0 -42
- package/@types/page/mountable.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -10
- package/@types/page/page.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -18
- package/@types/page/props-parser.d.sync-conflict-20250918-184305-TFDLWFG.ts +0 -15
- package/@types/page/stateful-page.d.sync-conflict-20250918-184326-TFDLWFG.ts +0 -62
- package/@types/templates/shared/handlers/boolean.d.ts +0 -2
- package/@types/templates/shared/handlers/date.d.ts +0 -2
- package/@types/templates/shared/handlers/deep-reverse-single-reference.d.ts +0 -2
- package/@types/templates/shared/handlers/default.d.ts +0 -2
- package/@types/templates/shared/handlers/enum.d.ts +0 -2
- package/@types/templates/shared/handlers/file.d.ts +0 -2
- package/@types/templates/shared/handlers/image.d.ts +0 -2
- package/@types/templates/shared/handlers/int.d.ts +0 -2
- package/@types/templates/shared/handlers/jdd.d.ts +0 -2
- package/@types/templates/shared/handlers/single-reference.d.ts +0 -2
- package/@types/templates/shared/handlers/structured-array.d.ts +0 -2
- package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -1
- package/@types/test_utils/test-on-real-app.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -26
- package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts +0 -18
- package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -18
- package/lib/controllers/table-add-button.stimulus.js +0 -35
- package/src/controllers/table-add-button.stimulus.ts +0 -35
- /package/@types/{add-crud.d.sync-conflict-20250918-184311-TFDLWFG.ts → app-config/get-app-port.test.d.ts} +0 -0
- /package/@types/{crud-field-snippets.d.sync-conflict-20250918-184323-TFDLWFG.ts → app-config/load-app-config.test.d.ts} +0 -0
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import Router from "@koa/router";
|
|
2
|
-
import { Context } from "koa";
|
|
3
|
-
import { FlatTemplatable } from "tempstream";
|
|
4
|
-
import type { FormDataValue } from "../forms/form-types.js";
|
|
5
|
-
import { Fields, MountableWithFields, PageErrorMessage } from "./mountable-with-fields.js";
|
|
6
|
-
import { PagePropsParser } from "./props-parser.js";
|
|
7
|
-
export declare abstract class Page<F extends Fields = Record<string, never>> extends MountableWithFields<F> {
|
|
8
|
-
propsParser: PagePropsParser<Record<keyof Fields, unknown>>;
|
|
9
|
-
controls: never[];
|
|
10
|
-
mount(router: Router, path: string): void;
|
|
11
|
-
canAccess(_: Context): Promise<{
|
|
12
|
-
canAccess: boolean;
|
|
13
|
-
message: string;
|
|
14
|
-
}>;
|
|
15
|
-
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
16
|
-
abstract render(ctx: Context): Promise<FlatTemplatable>;
|
|
17
|
-
extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
18
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../forms/form-types.js";
|
|
3
|
-
import type { BasePageProps } from "./list.js";
|
|
4
|
-
export type EncodedProps = Record<string, unknown>;
|
|
5
|
-
export declare abstract class PagePropsParser<PropsType> {
|
|
6
|
-
abstract decode(ctx: Context): Record<string, FormDataValue>;
|
|
7
|
-
abstract encode(props: Record<string, FormData>): EncodedProps;
|
|
8
|
-
abstract getHTMLInputName(prop_name: string): string;
|
|
9
|
-
overwriteProp(ctx: Context, new_props: Partial<PropsType>): EncodedProps;
|
|
10
|
-
}
|
|
11
|
-
export declare class AllQueryParams<PropsType extends BasePageProps> extends PagePropsParser<PropsType> {
|
|
12
|
-
decode(ctx: Context): Record<string, FormDataValue>;
|
|
13
|
-
encode(props: PropsType): Record<string, unknown>;
|
|
14
|
-
getHTMLInputName(prop_name: string): string;
|
|
15
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import Router from "@koa/router";
|
|
2
|
-
import { Context } from "koa";
|
|
3
|
-
import { Templatable } from "tempstream";
|
|
4
|
-
import { Mountable } from "./mountable.js";
|
|
5
|
-
export type StatefulPageActionDescription<ActionName> = {
|
|
6
|
-
action: ActionName;
|
|
7
|
-
label?: string;
|
|
8
|
-
content?: string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
} | ActionName;
|
|
11
|
-
export type StateAndMetadata<State, Actions> = {
|
|
12
|
-
state: State;
|
|
13
|
-
inputs: Record<string, string>;
|
|
14
|
-
action: keyof Actions;
|
|
15
|
-
action_args: string;
|
|
16
|
-
} | {
|
|
17
|
-
state: State;
|
|
18
|
-
inputs: Record<string, string>;
|
|
19
|
-
action: null;
|
|
20
|
-
action_args: null;
|
|
21
|
-
$: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
export type StatefulPageActionArgument<State extends Record<string, unknown>, Args extends unknown[] = unknown[]> = {
|
|
24
|
-
ctx: Context;
|
|
25
|
-
state: State;
|
|
26
|
-
inputs: Record<string, string>;
|
|
27
|
-
args: Args;
|
|
28
|
-
page: StatefulPage<any, any>;
|
|
29
|
-
};
|
|
30
|
-
export type StatefulPageAction<State extends Record<string, unknown>, Args extends unknown[] = unknown[]> = (obj: StatefulPageActionArgument<State, Args>) => State | Promise<State>;
|
|
31
|
-
export type ExtractStatefulPageActionArgs<X> = X extends StatefulPageAction<any, infer Args> ? Args : never;
|
|
32
|
-
export declare abstract class StatefulPage<State extends Record<string, unknown>, Actions extends Record<string, StatefulPageAction<State>>> extends Mountable {
|
|
33
|
-
abstract actions: Actions;
|
|
34
|
-
abstract getInitialState(ctx: Context): State | Promise<State>;
|
|
35
|
-
abstract render(ctx: Context, state: State, inputs: Record<string, string>): Templatable | Promise<Templatable>;
|
|
36
|
-
canAccess(_ctx: Context): Promise<{
|
|
37
|
-
canAccess: boolean;
|
|
38
|
-
message: string;
|
|
39
|
-
}>;
|
|
40
|
-
constructor();
|
|
41
|
-
abstract wrapInLayout(ctx: Context, content: Templatable, state: State): Templatable;
|
|
42
|
-
wrapInForm(context: Context, state: State, content: Templatable): Promise<Templatable>;
|
|
43
|
-
extractActionAndLabel<ActionName extends keyof Actions>(action_description: StatefulPageActionDescription<ActionName>): {
|
|
44
|
-
action: string;
|
|
45
|
-
label: string;
|
|
46
|
-
content: string;
|
|
47
|
-
disabled: boolean;
|
|
48
|
-
};
|
|
49
|
-
makeActionURL<ActionName extends keyof Actions>(action_description: StatefulPageActionDescription<ActionName>, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
50
|
-
makeActionButton<ActionName extends keyof Actions>(_state: State, action_description: StatefulPageActionDescription<ActionName>, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
51
|
-
makeActionCallback<ActionName extends keyof Actions>(action_description: {
|
|
52
|
-
action: ActionName;
|
|
53
|
-
label?: string;
|
|
54
|
-
} | ActionName, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
55
|
-
rerender(): string;
|
|
56
|
-
preprocessState(values: State): Promise<State>;
|
|
57
|
-
preprocessOverrides(_context: Context, _state: State, values: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
58
|
-
serializeState(_context: Context, state: State): Promise<string>;
|
|
59
|
-
deserializeState(_context: Context, s: string): Promise<State>;
|
|
60
|
-
extractState(ctx: Context): Promise<StateAndMetadata<State, Actions>>;
|
|
61
|
-
mount(router: Router, path: string): void;
|
|
62
|
-
}
|
package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sharedCrudFormFields(collection_name: string, newfilefullpath: string): Promise<string>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import EventEmitter from "events";
|
|
2
|
-
export declare const callSealgenBin: () => string;
|
|
3
|
-
export declare class RealAppTest {
|
|
4
|
-
node_pid: number;
|
|
5
|
-
app_port: number;
|
|
6
|
-
mongo_port: number;
|
|
7
|
-
app_path: string;
|
|
8
|
-
container_name: string;
|
|
9
|
-
emitter: EventEmitter<[never]>;
|
|
10
|
-
static init(): Promise<RealAppTest>;
|
|
11
|
-
start(): Promise<void>;
|
|
12
|
-
close(): Promise<void>;
|
|
13
|
-
runSealgenCommand(command: string): Promise<void>;
|
|
14
|
-
build(): Promise<void>;
|
|
15
|
-
throwIfItKillsTheApp<T>(cb: () => Promise<T>): Promise<T>;
|
|
16
|
-
httpGET(path: string): Promise<{
|
|
17
|
-
status: number;
|
|
18
|
-
response: string;
|
|
19
|
-
}>;
|
|
20
|
-
httpPOST(path: string, body: Record<string, unknown>): Promise<{
|
|
21
|
-
status: number;
|
|
22
|
-
response: string;
|
|
23
|
-
}>;
|
|
24
|
-
addFile(target_path: string, content: string): Promise<void>;
|
|
25
|
-
fullURL(path: string): string;
|
|
26
|
-
}
|
package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FormField } from "../forms/fields/field.js";
|
|
2
|
-
export type ExtractedFieldInfo = {
|
|
3
|
-
name: string;
|
|
4
|
-
type: string;
|
|
5
|
-
target: string | null;
|
|
6
|
-
referencing_collection: string | null;
|
|
7
|
-
referencing_field: string | null;
|
|
8
|
-
intermediary_field_that_points_there: string | null;
|
|
9
|
-
is_readonly: boolean;
|
|
10
|
-
is_required: boolean;
|
|
11
|
-
subfields: {
|
|
12
|
-
name: string;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
export type ExtractedFieldInfoWithFormField = ExtractedFieldInfo & {
|
|
16
|
-
form_field: FormField;
|
|
17
|
-
};
|
|
18
|
-
export default function extract_fields_from_collection(collection_name: string): Promise<ExtractedFieldInfoWithFormField[]>;
|
package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FormField } from "../forms/fields/field.js";
|
|
2
|
-
export type ExtractedFieldInfo = {
|
|
3
|
-
name: string;
|
|
4
|
-
type: string;
|
|
5
|
-
target: string | null;
|
|
6
|
-
referencing_collection: string | null;
|
|
7
|
-
referencing_field: string | null;
|
|
8
|
-
intermediary_field_that_points_there: string | null;
|
|
9
|
-
is_readonly: boolean;
|
|
10
|
-
is_required: boolean;
|
|
11
|
-
subfields: {
|
|
12
|
-
name: string;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
export type ExtractedFieldInfoWithFormField = ExtractedFieldInfo & {
|
|
16
|
-
form_field: FormField;
|
|
17
|
-
};
|
|
18
|
-
export default function extract_fields_from_collection(collection_name: string): Promise<ExtractedFieldInfoWithFormField[]>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Controller } from "stimulus";
|
|
2
|
-
class table_add_button_stimulus_default extends Controller {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
this.defaultRowsNumber = 20;
|
|
6
|
-
}
|
|
7
|
-
static {
|
|
8
|
-
this.targets = ["textarea"];
|
|
9
|
-
}
|
|
10
|
-
addRow() {
|
|
11
|
-
const template = this.element.closest("turbo-frame")?.querySelector("template");
|
|
12
|
-
if (!template) {
|
|
13
|
-
throw new Error("Couldn't find template");
|
|
14
|
-
}
|
|
15
|
-
const tbody = this.element.closest("turbo-frame")?.querySelector("tbody");
|
|
16
|
-
if (!tbody) {
|
|
17
|
-
throw new Error("tbody not found");
|
|
18
|
-
}
|
|
19
|
-
const orig_template = template.innerHTML;
|
|
20
|
-
const placeholder = this.element.getAttribute("data-table-placeholder");
|
|
21
|
-
if (!placeholder) {
|
|
22
|
-
throw new Error("Could find placeholder attribute");
|
|
23
|
-
}
|
|
24
|
-
template.innerHTML = orig_template.replaceAll(
|
|
25
|
-
placeholder,
|
|
26
|
-
String(tbody.querySelectorAll("tr").length)
|
|
27
|
-
);
|
|
28
|
-
tbody.appendChild(template.cloneNode(true).content);
|
|
29
|
-
template.innerHTML = orig_template;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
table_add_button_stimulus_default as default
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=table-add-button.stimulus.js.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/// <reference lib="dom" />
|
|
2
|
-
import { Controller } from "stimulus";
|
|
3
|
-
|
|
4
|
-
export default class extends Controller {
|
|
5
|
-
static targets = ["textarea"];
|
|
6
|
-
defaultRowsNumber = 20;
|
|
7
|
-
|
|
8
|
-
addRow() {
|
|
9
|
-
const template = this.element
|
|
10
|
-
.closest("turbo-frame")
|
|
11
|
-
?.querySelector("template");
|
|
12
|
-
if (!template) {
|
|
13
|
-
throw new Error("Couldn't find template");
|
|
14
|
-
}
|
|
15
|
-
const tbody = this.element
|
|
16
|
-
.closest("turbo-frame")
|
|
17
|
-
?.querySelector("tbody");
|
|
18
|
-
if (!tbody) {
|
|
19
|
-
throw new Error("tbody not found");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const orig_template = template.innerHTML;
|
|
23
|
-
const placeholder = this.element.getAttribute("data-table-placeholder");
|
|
24
|
-
if (!placeholder) {
|
|
25
|
-
throw new Error("Could find placeholder attribute");
|
|
26
|
-
}
|
|
27
|
-
template.innerHTML = orig_template.replaceAll(
|
|
28
|
-
placeholder,
|
|
29
|
-
String(tbody.querySelectorAll("tr").length)
|
|
30
|
-
);
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
|
32
|
-
tbody.appendChild((template.cloneNode(true) as any).content);
|
|
33
|
-
template.innerHTML = orig_template;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
File without changes
|