@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.
Files changed (128) hide show
  1. package/@types/app-config/get-app-port.d.ts +1 -0
  2. package/@types/app-config/load-app-config.d.ts +4 -0
  3. package/@types/app-config/resolve-app-config-path.d.ts +1 -0
  4. package/@types/controllers/sealgen-table.stimulus.d.ts +9 -0
  5. package/@types/forms/controls/table.d.ts +2 -0
  6. package/@types/forms/fields/structured-array.d.ts +2 -2
  7. package/@types/utils/translate.d.ts +2 -1
  8. package/lib/controllers/sealgen-table.stimulus.js +98 -0
  9. package/lib/forms/controls/table.js +49 -43
  10. package/lib/forms/controls/tickable.js +1 -3
  11. package/lib/forms/fields/collection-field.js +2 -1
  12. package/lib/generate-routes.js +23 -1
  13. package/lib/mount.js +8 -10
  14. package/lib/utils/translate.js +4 -4
  15. package/package.json +2 -2
  16. package/src/controllers/sealgen-table.stimulus.ts +115 -0
  17. package/src/forms/controls/table.ts +94 -81
  18. package/src/forms/fields/collection-field.ts +2 -1
  19. package/src/forms/fields/structured-array.ts +2 -11
  20. package/src/generate-routes.ts +38 -9
  21. package/src/mount.ts +8 -12
  22. package/.xunit +0 -75
  23. package/@types/add-verbose-crud.d.ts +0 -3
  24. package/@types/builders/colors-builder.d.sync-conflict-20250918-184323-TFDLWFG.ts +0 -10
  25. package/@types/builders/fonts-builder.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -7
  26. package/@types/controllers/table-add-button.d.ts +0 -6
  27. package/@types/crud-field-snippets.d.ts +0 -1
  28. package/@types/find-css-includes.d.ts +0 -1
  29. package/@types/forms/controls/array.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -33
  30. package/@types/forms/controls/array.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -33
  31. package/@types/forms/controls/autocomplete.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -22
  32. package/@types/forms/controls/checkbox-group.d.sync-conflict-20250918-184319-TFDLWFG.ts +0 -21
  33. package/@types/forms/controls/checkboxed-list-input.d.sync-conflict-20250918-184323-TFDLWFG.ts +0 -21
  34. package/@types/forms/controls/derived-frame.d.sync-conflict-20250918-184314-TFDLWFG.ts +0 -19
  35. package/@types/forms/controls/dropdown.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -30
  36. package/@types/forms/controls/file.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -13
  37. package/@types/forms/controls/form-control.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -19
  38. package/@types/forms/controls/form-control.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -19
  39. package/@types/forms/controls/multiple-files.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -42
  40. package/@types/forms/controls/multiple-photos.d.ts +0 -19
  41. package/@types/forms/controls/number.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -13
  42. package/@types/forms/controls/photo.d.sync-conflict-20250918-184321-TFDLWFG.ts +0 -19
  43. package/@types/forms/controls/photo.d.ts +0 -19
  44. package/@types/forms/controls/photo.test.d.ts +0 -1
  45. package/@types/forms/controls/reverse-single-reference.d.ts +0 -1
  46. package/@types/forms/controls/simple-input.d.sync-conflict-20250918-184310-TFDLWFG.ts +0 -33
  47. package/@types/forms/controls/simple-input.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -33
  48. package/@types/forms/controls/simple-input.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -33
  49. package/@types/forms/controls/table.d.sync-conflict-20250918-184302-TFDLWFG.ts +0 -39
  50. package/@types/forms/controls/table.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -39
  51. package/@types/forms/controls/textarea.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -25
  52. package/@types/forms/fields/boolean.d.sync-conflict-20250918-184325-TFDLWFG.ts +0 -22
  53. package/@types/forms/fields/boolean.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -22
  54. package/@types/forms/fields/checkboxed-list.d.sync-conflict-20250918-184325-TFDLWFG.ts +0 -23
  55. package/@types/forms/fields/collection-field.d.sync-conflict-20250918-184319-TFDLWFG.ts +0 -22
  56. package/@types/forms/fields/collection-field.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -22
  57. package/@types/forms/fields/coordinates.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -14
  58. package/@types/forms/fields/datetime.d.sync-conflict-20250918-222050-TFDLWFG.ts +0 -4
  59. package/@types/forms/fields/email.d.sync-conflict-20250918-184303-TFDLWFG.ts +0 -8
  60. package/@types/forms/fields/enum-multiple-sealious.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -16
  61. package/@types/forms/fields/enum-multiple.d.ts +0 -18
  62. package/@types/forms/fields/enum-multiple.test.d.ts +0 -1
  63. package/@types/forms/fields/enum.d.ts +0 -18
  64. package/@types/forms/fields/enum.test.d.ts +0 -1
  65. package/@types/forms/fields/field.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -70
  66. package/@types/forms/fields/fields.d.sync-conflict-20250918-184314-TFDLWFG.ts +0 -29
  67. package/@types/forms/fields/file.d.sync-conflict-20250918-184310-TFDLWFG.ts +0 -23
  68. package/@types/forms/fields/file.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -23
  69. package/@types/forms/fields/file.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -23
  70. package/@types/forms/fields/get-field-for-sealious.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -29
  71. package/@types/forms/fields/get-field-for-sealious.sync-conflict-20250918-222042-TFDLWFG.d.ts +0 -29
  72. package/@types/forms/fields/image.d.sync-conflict-20250918-222042-TFDLWFG.ts +0 -5
  73. package/@types/forms/fields/multiple-files.d.sync-conflict-20250918-184304-TFDLWFG.ts +0 -16
  74. package/@types/forms/fields/number.d.sync-conflict-20250918-184317-TFDLWFG.ts +0 -25
  75. package/@types/forms/fields/number.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -25
  76. package/@types/forms/fields/pick-from-list.d.sync-conflict-20250918-184322-TFDLWFG.ts +0 -15
  77. package/@types/forms/fields/proxy-field.d.sync-conflict-20250918-184307-TFDLWFG.ts +0 -15
  78. package/@types/forms/fields/regexp.d.sync-conflict-20250918-184305-TFDLWFG.ts +0 -21
  79. package/@types/forms/fields/regexp.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -21
  80. package/@types/forms/fields/regexp.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -21
  81. package/@types/forms/fields/reverse-single-reference.d.ts +0 -13
  82. package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-184309-TFDLWFG.ts +0 -29
  83. package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-222044-TFDLWFG.ts +0 -29
  84. package/@types/forms/fields/simple-form-field.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -29
  85. package/@types/forms/fields/single-reference.sync-conflict-20250918-222043-TFDLWFG.d.ts +0 -10
  86. package/@types/forms/fields/structured-array.d.sync-conflict-20250918-184302-TFDLWFG.ts +0 -27
  87. package/@types/forms/fields/structured-array.d.sync-conflict-20250918-222049-TFDLWFG.ts +0 -27
  88. package/@types/forms/fields/structured-array.sync-conflict-20250918-222047-TFDLWFG.d.ts +0 -27
  89. package/@types/forms/fields/table.d.sync-conflict-20250918-184303-TFDLWFG.ts +0 -16
  90. package/@types/forms/form-types.d.sync-conflict-20250918-222045-TFDLWFG.ts +0 -26
  91. package/@types/forms/form.d.sync-conflict-20250918-184315-TFDLWFG.ts +0 -32
  92. package/@types/forms/form.d.sync-conflict-20250918-222049-TFDLWFG.ts +0 -32
  93. package/@types/forms/form.sync-conflict-20250918-222049-TFDLWFG.d.ts +0 -33
  94. package/@types/forms/form.test.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -6
  95. package/@types/forms/form.test.d.sync-conflict-20250918-222047-TFDLWFG.ts +0 -6
  96. package/@types/forms/multiform.d.sync-conflict-20250918-184308-TFDLWFG.ts +0 -23
  97. package/@types/forms/multiform.sync-conflict-20250918-222044-TFDLWFG.d.ts +0 -23
  98. package/@types/index.d.sync-conflict-20250918-184316-TFDLWFG.ts +0 -46
  99. package/@types/mount.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -6
  100. package/@types/page/list.d.sync-conflict-20250918-184318-TFDLWFG.ts +0 -48
  101. package/@types/page/list.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -48
  102. package/@types/page/list.sync-conflict-20250918-222048-TFDLWFG.d.ts +0 -48
  103. package/@types/page/mountable-with-fields.d.sync-conflict-20250918-184321-TFDLWFG.ts +0 -42
  104. package/@types/page/mountable-with-fields.d.sync-conflict-20250918-222046-TFDLWFG.ts +0 -42
  105. package/@types/page/mountable-with-fields.sync-conflict-20250918-222044-TFDLWFG.d.ts +0 -42
  106. package/@types/page/mountable.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -10
  107. package/@types/page/page.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -18
  108. package/@types/page/props-parser.d.sync-conflict-20250918-184305-TFDLWFG.ts +0 -15
  109. package/@types/page/stateful-page.d.sync-conflict-20250918-184326-TFDLWFG.ts +0 -62
  110. package/@types/templates/shared/handlers/boolean.d.ts +0 -2
  111. package/@types/templates/shared/handlers/date.d.ts +0 -2
  112. package/@types/templates/shared/handlers/deep-reverse-single-reference.d.ts +0 -2
  113. package/@types/templates/shared/handlers/default.d.ts +0 -2
  114. package/@types/templates/shared/handlers/enum.d.ts +0 -2
  115. package/@types/templates/shared/handlers/file.d.ts +0 -2
  116. package/@types/templates/shared/handlers/image.d.ts +0 -2
  117. package/@types/templates/shared/handlers/int.d.ts +0 -2
  118. package/@types/templates/shared/handlers/jdd.d.ts +0 -2
  119. package/@types/templates/shared/handlers/single-reference.d.ts +0 -2
  120. package/@types/templates/shared/handlers/structured-array.d.ts +0 -2
  121. package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts +0 -1
  122. package/@types/test_utils/test-on-real-app.d.sync-conflict-20250918-184320-TFDLWFG.ts +0 -26
  123. package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts +0 -18
  124. package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts +0 -18
  125. package/lib/controllers/table-add-button.stimulus.js +0 -35
  126. package/src/controllers/table-add-button.stimulus.ts +0 -35
  127. /package/@types/{add-crud.d.sync-conflict-20250918-184311-TFDLWFG.ts → app-config/get-app-port.test.d.ts} +0 -0
  128. /package/@types/{crud-field-snippets.d.sync-conflict-20250918-184323-TFDLWFG.ts → app-config/load-app-config.test.d.ts} +0 -0
@@ -21,6 +21,7 @@ export type TableControlOptions<F extends Record<string, FormField>> = {
21
21
  [field_name in keyof F]: FormControl;
22
22
  };
23
23
  allow_removing?: boolean;
24
+ allow_reordering?: boolean;
24
25
  label_add?: string;
25
26
  label: string;
26
27
  label_remove?: string;
@@ -62,8 +63,8 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
62
63
  | null,
63
64
  row_index: number | string
64
65
  ) => {
65
- return typeof row_index == "number"
66
- ? {
66
+ return typeof row_index == "number" ?
67
+ {
67
68
  data: {
68
69
  raw_values:
69
70
  (Object.fromEntries(
@@ -78,7 +79,7 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
78
79
  field_messages: {},
79
80
  },
80
81
  }
81
- : {};
82
+ : {};
82
83
  };
83
84
 
84
85
  const make_row = async (
@@ -89,7 +90,7 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
89
90
  >;
90
91
  }
91
92
  | null,
92
- row_index: number | string
93
+ row_index: number | string // when string, it's a placeholder, it will not parse as a number
93
94
  ) => {
94
95
  return /* HTML */ tempstream`<tr>
95
96
  ${Promise.all(
@@ -108,33 +109,42 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
108
109
  )
109
110
  )}
110
111
  ${
111
- this.options.allow_removing
112
- ? /* HTML */ `<td>
113
- <button
114
- onclick="this.closest('tr').remove()"
115
- >
116
- remove
117
- </button>
118
- <noscript>
119
- <input
120
- type="submit"
121
- data-turbo-frame="${this.getFrameID()}"
122
- value="${this.options
123
- .label_remove || "remove"}"
124
- form="${fctx.form_id}"
125
- formnovalidate
126
- formaction="${this.getActionURL(
127
- this.table_field.name,
128
- {
129
- remove: {
130
- index: row_index,
131
- },
132
- }
133
- )}"
134
- />
135
- </noscript>
136
- </td>`
137
- : ""
112
+ this.options.allow_removing ?
113
+ /* HTML */ `<td>
114
+ <button onclick="this.closest('tr').remove()">
115
+ remove
116
+ </button>
117
+ <noscript>
118
+ <input
119
+ type="submit"
120
+ data-turbo-frame="${this.getFrameID()}"
121
+ value="${this.options.label_remove ||
122
+ "remove"}"
123
+ form="${fctx.form_id}"
124
+ formnovalidate
125
+ formaction="${this.getActionURL(
126
+ this.table_field.name,
127
+ {
128
+ remove: {
129
+ index: row_index,
130
+ },
131
+ }
132
+ )}"
133
+ />
134
+ </noscript>
135
+ </td>`
136
+ : ""
137
+ }${
138
+ this.options.allow_reordering ?
139
+ /* HTML */ `<td>
140
+ <button data-action="sealgen-table#moveUp">
141
+ ↑
142
+ </button>
143
+ <button data-action="sealgen-table#moveDown">
144
+ ↓
145
+ </button>
146
+ </td>`
147
+ : ""
138
148
  }
139
149
  </tr>`;
140
150
  };
@@ -145,60 +155,62 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
145
155
  "form-input__wrapper",
146
156
  "form-input__wrapper--type--table",
147
157
  "form-input__wrapper--options-count--" + rows.length.toString(),
148
- ...(rows.length >= 5
149
- ? ["form-input__wrapper--options-count--5-or-more"]
150
- : []),
151
- ...(rows.length >= 10
152
- ? ["form-input__wrapper--options-count--10-or-more"]
153
- : []),
154
- ...(rows.length >= 15
155
- ? ["form-input__wrapper--options-count--15-or-more"]
156
- : []),
157
- ...(rows.length >= 20
158
- ? ["form-input__wrapper--options-count--20-or-more"]
159
- : []),
158
+ ...(rows.length >= 5 ?
159
+ ["form-input__wrapper--options-count--5-or-more"]
160
+ : []),
161
+ ...(rows.length >= 10 ?
162
+ ["form-input__wrapper--options-count--10-or-more"]
163
+ : []),
164
+ ...(rows.length >= 15 ?
165
+ ["form-input__wrapper--options-count--15-or-more"]
166
+ : []),
167
+ ...(rows.length >= 20 ?
168
+ ["form-input__wrapper--options-count--20-or-more"]
169
+ : []),
160
170
  ].join(" ")}"
161
171
  >
162
172
  <label>${this.options.label || this.table_field.label}</label>
163
- <div class="table__wrapper">
164
- <table>
173
+ <div
174
+ class="table__wrapper"
175
+ data-controller="sealgen-table"
176
+ data-table-placeholder="${TABLE_COLUMN_FIELD_INDEX_PLACEHOLDER}"
177
+ >
178
+ <table data-sealgen-table-target="table">
165
179
  <tbody>
166
180
  ${rows?.map((row, index) => make_row(row, index))}
167
181
  </tbody>
168
182
  </table>
169
- <template>
183
+ <template data-sealgen-table-target="template">
170
184
  ${make_row(null, TABLE_COLUMN_FIELD_INDEX_PLACEHOLDER)}
171
185
  </template>
172
186
 
173
187
  ${
174
188
  /* because of https://github.com/ljharb/qs/issues/252 we have to
175
189
  put the indexes in the field names */
176
- this.options.allow_adding
177
- ? /* HTML */ `<button
178
- data-controller="table-add-button"
179
- data-action="click->table-add-button#addRow"
180
- data-table-placeholder="${TABLE_COLUMN_FIELD_INDEX_PLACEHOLDER}"
181
- >
182
- ${this.options.label_add || "add"}
183
- </button>
184
- <noscript>
185
- <input
186
- type="submit"
187
- value="add"
188
- form="${fctx.form_id}"
189
- formnovalidate
190
- formaction="${this.getActionURL(
191
- this.table_field.name,
192
- {
193
- insert: {
194
- index: rows.length,
195
- value: {},
196
- },
197
- }
198
- )}"
199
- />
200
- </noscript>`
201
- : ""
190
+ this.options.allow_adding ?
191
+ /* HTML */ `<button
192
+ data-action="click->sealgen-table#addRow"
193
+ >
194
+ ${this.options.label_add || "add"}
195
+ </button>
196
+ <noscript>
197
+ <input
198
+ type="submit"
199
+ value="add"
200
+ form="${fctx.form_id}"
201
+ formnovalidate
202
+ formaction="${this.getActionURL(
203
+ this.table_field.name,
204
+ {
205
+ insert: {
206
+ index: rows.length,
207
+ value: {},
208
+ },
209
+ }
210
+ )}"
211
+ />
212
+ </noscript>`
213
+ : ""
202
214
  }
203
215
  </div>
204
216
  </turbo-frame>`;
@@ -221,11 +233,13 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
221
233
  const field_name = ctx.$body.field_name;
222
234
  if (
223
235
  !is(action, predicates.object) ||
224
- !is(field_name, predicates.string)
236
+ !is(field_name, predicates.string) ||
237
+ field_name !== this.table_field.name
225
238
  ) {
226
239
  await next();
227
240
  return;
228
241
  }
242
+
229
243
  if (
230
244
  this.options.allow_adding &&
231
245
  hasShape(
@@ -235,16 +249,13 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
235
249
  action
236
250
  )
237
251
  ) {
238
- if (field_name !== this.table_field.name) {
239
- await next();
240
- return;
241
- }
242
252
  if (!ctx.$body[this.table_field.name]) {
243
253
  ctx.$body[this.table_field.name] = {};
244
254
  }
245
255
  (ctx.$body[this.table_field.name] as any)[action.insert.index] =
246
256
  await this.options.make_new_row(ctx);
247
257
  }
258
+
248
259
  if (
249
260
  hasShape(
250
261
  {
@@ -253,10 +264,6 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
253
264
  action
254
265
  )
255
266
  ) {
256
- if (field_name !== this.table_field.name) {
257
- await next();
258
- return;
259
- }
260
267
  if (!ctx.$body[this.table_field.name]) {
261
268
  ctx.$body[this.table_field.name] = {};
262
269
  }
@@ -270,6 +277,7 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
270
277
  )
271
278
  );
272
279
  }
280
+
273
281
  ctx.override_reaction = {
274
282
  action: "stay",
275
283
  content: await form.render(
@@ -310,4 +318,9 @@ export class Table<F extends Record<string, FormField>> extends FormControl {
310
318
  this.options.label_add = value;
311
319
  return this;
312
320
  }
321
+
322
+ setAllowReordering(value: boolean) {
323
+ this.options.allow_reordering = value;
324
+ return this;
325
+ }
313
326
  }
@@ -58,7 +58,8 @@ export class CollectionField<
58
58
  ctx.$context,
59
59
  value,
60
60
  undefined,
61
- null
61
+ null,
62
+ undefined
62
63
  );
63
64
  return { valid, message: reason || (!valid ? "Wrong value" : "") };
64
65
  }
@@ -7,7 +7,6 @@ import { Context } from "koa";
7
7
  import {
8
8
  Field as SealiousField,
9
9
  FieldTypes as SealiousFieldTypes,
10
- FieldsetInput,
11
10
  } from "sealious";
12
11
  import { FormDataValue } from "../form-types.js";
13
12
  import { Table as TableControl } from "../controls/table.js";
@@ -74,20 +73,12 @@ export class StructuredArray<
74
73
  return `new ${vars.form_field_types}.${this.constructor.name}(${vars.sealious_field})`;
75
74
  }
76
75
 
77
- async getSealiousCreateValue(
78
- fctx: FormControlContext
79
- ): Promise<
80
- SealiousFieldTypes.ArrayStorageInput<FieldsetInput<SealiousFields>>
81
- > {
76
+ async getSealiousCreateValue(fctx: FormControlContext) {
82
77
  const { parsed } = await this.getParsedValue(
83
78
  fctx.ctx,
84
79
  fctx.data.raw_values
85
80
  );
86
- return (
87
- (parsed as SealiousFieldTypes.ArrayStorageInput<
88
- FieldsetInput<SealiousFields>
89
- >) || this.getEmptyValue()
90
- );
81
+ return parsed || this.getEmptyValue();
91
82
  }
92
83
 
93
84
  async sealiousValueToForm(
@@ -35,9 +35,9 @@ export function generateURL(actionName: string, url: string) {
35
35
  .map((s) => s + ": string")
36
36
  .join(", ")})=>\`${parts
37
37
  .map((part) =>
38
- part.startsWith(":")
39
- ? "${" + part.slice(1) + "}"
40
- : encodeURIComponent(part)
38
+ part.startsWith(":") ?
39
+ "${" + part.slice(1) + "}"
40
+ : encodeURIComponent(part)
41
41
  )
42
42
  .join("/")}\`;
43
43
  ${actionName}URL.params = [${params
@@ -86,9 +86,9 @@ export async function generateRoutes(): Promise<void> {
86
86
  target_locreq.resolve("src/back/routes"),
87
87
  resolve(
88
88
  fullpath,
89
- basename(fullpath).startsWith("index.")
90
- ? "../"
91
- : ""
89
+ basename(fullpath).startsWith("index.") ?
90
+ "../"
91
+ : ""
92
92
  )
93
93
  ).replace(/\..+/, "") +
94
94
  "/"
@@ -96,8 +96,35 @@ export async function generateRoutes(): Promise<void> {
96
96
  }))
97
97
  );
98
98
 
99
+ type URLTree = {
100
+ actionName?: string;
101
+ children: { [key: string]: URLTree };
102
+ };
103
+
104
+ const url_tree: URLTree = { children: {} };
105
+ sortRoutes(files).forEach(({ actionName, url }) => {
106
+ const elements = url.split("/").filter((e) => e != "");
107
+ let pointer: URLTree = url_tree;
108
+ for (const [index, element] of elements.entries()) {
109
+ if (!pointer.children[element]) {
110
+ pointer.children[element] = { children: {} };
111
+ }
112
+ pointer = pointer.children[element];
113
+ if (index == elements.length - 1) {
114
+ (pointer as unknown as { actionName: string }).actionName =
115
+ actionName;
116
+ }
117
+ }
118
+ });
119
+
99
120
  const routes_content = `// DO NOT EDIT! This file is generated automaticaly with npm run generate-routes
100
121
 
122
+ export type URLTree = {
123
+ actionName?: string;
124
+ children: { [key: string]: URLTree };
125
+ };
126
+ export const url_tree = ${JSON.stringify(url_tree)};
127
+
101
128
  import type Router from "@koa/router";
102
129
  import { mount } from "@sealcode/sealgen";
103
130
  import * as URLs from "./urls.js"
@@ -121,9 +148,11 @@ ${sortRoutes(files)
121
148
  .join("\n")}
122
149
  }`;
123
150
 
124
- const urls_content = `${sortRoutes(files)
125
- .map(({ actionName, url }) => generateURL(actionName, url))
126
- .join("\n")}
151
+ const urls_content = `/* DO NOT EDIT! This file is generated automaticall with npm run generate-routes. */
152
+
153
+ ${sortRoutes(files)
154
+ .map(({ actionName, url }) => generateURL(actionName, url))
155
+ .join("\n")}
127
156
  `;
128
157
 
129
158
  await fs.writeFile(
package/src/mount.ts CHANGED
@@ -25,16 +25,6 @@ export function mount(
25
25
  ): void {
26
26
  const raw_url = typeof url === "string" ? url : url.rawURL;
27
27
 
28
- const imageRouter = new KoaResponsiveImageRouter({
29
- staticPath: "/tmp",
30
- thumbnailSize: 10,
31
- cacheManagerResolutionThreshold: 10,
32
- imageStoragePath: "/tmp",
33
- smartCropStoragePath: "/tmp",
34
- });
35
-
36
- const fileManager = new FileManager("/tmp", "/uploaded_files");
37
-
38
28
  const args =
39
29
  use_dummy_app ?
40
30
  [
@@ -44,8 +34,14 @@ export function mount(
44
34
  // regard
45
35
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
46
36
  ctx.$app = {
47
- fileManager,
48
- imageRouter,
37
+ fileManager: new FileManager("/tmp", "/uploaded_files"),
38
+ imageRouter: new KoaResponsiveImageRouter({
39
+ staticPath: "/tmp",
40
+ thumbnailSize: 10,
41
+ cacheManagerResolutionThreshold: 10,
42
+ imageStoragePath: "/tmp",
43
+ smartCropStoragePath: "/tmp",
44
+ }),
49
45
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
50
46
  Logger: new Proxy(
51
47
  {},
package/.xunit DELETED
@@ -1,75 +0,0 @@
1
- <testsuite name="Mocha Tests" tests="73" failures="0" errors="0" skipped="0" timestamp="Sun, 21 Sep 2025 18:00:04 GMT" time="312.378">
2
- <testcase classname="single-reference" name="creates an item list page with working partial string search for text fields" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/add-list-route.test.js" time="26.145"/>
3
- <testcase classname="add route test" name="creates minimal sealious app and adds a simple route that works" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/add-route.test.js" time="20.509"/>
4
- <testcase classname="empty test" name="empty test" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/example.test.js" time="0"/>
5
- <testcase classname="checkboxed-list basic tests" name="sends the values" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/checkboxed-list-input.test.js" time="0.484"/>
6
- <testcase classname="checkboxed-list basic tests" name="renders the label" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/checkboxed-list-input.test.js" time="0.375"/>
7
- <testcase classname="checkboxed-list basic tests" name="groups checkboxes based on the value of the &#x27;group&#x27; attribute" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/checkboxed-list-input.test.js" time="0.57"/>
8
- <testcase classname="checkboxed-list basic tests behavior with (non)required" name="allows to send a form when no value is selected and fiels is not required" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/checkboxed-list-input.test.js" time="0.454"/>
9
- <testcase classname="checkboxed-list basic tests behavior with (non)required" name="does not allow to send a form when no value is selected and field IS required" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/checkboxed-list-input.test.js" time="0.559"/>
10
- <testcase classname="checkboxed-list basic tests behavior with (non)required" name="allows to send a form when no value is selected and field IS required" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/checkboxed-list-input.test.js" time="0.562"/>
11
- <testcase classname="file-control basic tests" name="doesn&#x27;t require image input if it already has old-value" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/file.test.js" time="0.537"/>
12
- <testcase classname="photo-control basic tests" name="sends the old photo if it wasn&#x27;t changed and it has an initial value" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/image.test.js" time="0.472"/>
13
- <testcase classname="photo-control basic tests" name="doesn&#x27;t require image input if it already has old-value" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/image.test.js" time="0.515"/>
14
- <testcase classname="single-reference.test" name="creates minimal sealious app and adds form using single-reference field that works" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/controls/single-reference.test.js" time="28.324"/>
15
- <testcase classname="boolean field" name="validation logic" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/boolean.test.js" time="0"/>
16
- <testcase classname="boolean field" name="parse function" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/boolean.test.js" time="0.001"/>
17
- <testcase classname="email field" name="validation logic" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/email.test.js" time="0.001"/>
18
- <testcase classname="email field" name="parse function" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/email.test.js" time="0"/>
19
- <testcase classname="basic field basic tests" name="sends the values" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/field.test.js" time="0.331"/>
20
- <testcase classname="basic field basic tests" name="Doesn&#x27;t call &#x60;isValueValid&#x60; and &#x60;parse&#x60; if the value is empty" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/field.test.js" time="0.47"/>
21
- <testcase classname="basic field basic tests" name="Accepts a form where non-required values are empty" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/field.test.js" time="0.546"/>
22
- <testcase classname="file field" name="should handle as imple upload scenario" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/file.test.js" time="0.487"/>
23
- <testcase classname="number field" name="validation logic" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/number.test.js" time="0.001"/>
24
- <testcase classname="number field" name="parse function" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/number.test.js" time="0"/>
25
- <testcase classname="pick-from-list field" name="validation logic" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/pick-from-list.test.js" time="0.001"/>
26
- <testcase classname="regexp field" name="validation logic" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/regexp.test.js" time="0"/>
27
- <testcase classname="regexp field" name="parse function" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/fields/regexp.test.js" time="0"/>
28
- <testcase classname="form test basic tests" name="does not allow to submit an empty form when there&#x27;s a required field" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.621"/>
29
- <testcase classname="form test basic tests" name="allows to submit a form when all required fields have a value" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.202"/>
30
- <testcase classname="form test basic tests" name="does not allow submitting an empty form by circumventing HTML-based validation" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.026"/>
31
- <testcase classname="form test canAccess tests" name="allows visit when configured when canAccess returns true" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.02"/>
32
- <testcase classname="form test canAccess tests" name="passes the context to canAccess (false case)" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.017"/>
33
- <testcase classname="form test canAccess tests" name="passes the context to canAccess (true case)" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.019"/>
34
- <testcase classname="form test canAccess tests declines access when canAccess returns false" name="prevents the form from rendering" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.014"/>
35
- <testcase classname="form test canAccess tests declines access when canAccess returns false" name="does not allow submitting of the form through axios" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.004"/>
36
- <testcase classname="form test validation e2e validation message" name="shows up when incorrect input is given" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.267"/>
37
- <testcase classname="form test validation e2e validation message" name="doesn&#x27;t show when correct input is given" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.643"/>
38
- <testcase classname="form test validation e2e field specific validation message" name="shows up when incorrect input is given" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.242"/>
39
- <testcase classname="form test validation e2e field specific validation message" name="doesn&#x27;t show up when correct input is given" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.135"/>
40
- <testcase classname="form test getInitialValues tests" name="fills the form with values from getInitialValues" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/form.test.js" time="0.058"/>
41
- <testcase classname="multiform test basic tests turbolinks + js enabled" name="checking whether only one submit handler is run" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.595"/>
42
- <testcase classname="multiform test basic tests turbolinks + js enabled" name="checking whether the input in the not submitted form prevails" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.007"/>
43
- <testcase classname="multiform test basic tests turbolinks + js disabled" name="checking whether only one submit handler is run" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.577"/>
44
- <testcase classname="multiform test basic tests turbolinks + js disabled" name="checking whether the input in the not submitted form prevails" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.008"/>
45
- <testcase classname="multiform test canAccess allow access to both forms when both canAccess return true" name="check wether it renders" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="1.023"/>
46
- <testcase classname="multiform test canAccess allow access to both forms when both canAccess return true" name="check wether you can submit through http (axios)" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.007"/>
47
- <testcase classname="multiform test canAccess deny access to both forms" name="check wether forms didnt render" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.481"/>
48
- <testcase classname="multiform test canAccess deny access to both forms" name="check wether it&#x27;s possible to submit through http" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.008"/>
49
- <testcase classname="multiform test canAccess allow access to one form, deny to the other" name="check wether form1 renders" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.535"/>
50
- <testcase classname="multiform test canAccess allow access to one form, deny to the other" name="check wether it&#x27;s possible to submit to form1 through http" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.003"/>
51
- <testcase classname="multiform test canAccess allow access to one form, deny to the other" name="check wether form2 does not render" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.334"/>
52
- <testcase classname="multiform test canAccess allow access to one form, deny to the other" name="check wether it&#x27;s possible to submit to form2 through http" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.003"/>
53
- <testcase classname="multiform test validation e2e basic tests" name="js enabled" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="1.319"/>
54
- <testcase classname="multiform test validation e2e basic tests" name="js disabled" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.948"/>
55
- <testcase classname="multiform test validation e2e field specific validation js enabled" name="validation message shows when incorrect input is given" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.225"/>
56
- <testcase classname="multiform test validation e2e field specific validation js enabled" name="validation message doesn&#x27;t show when correct input is given" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.127"/>
57
- <testcase classname="multiform test validation e2e field specific validation js disabled" name="validation message shows when incorrect input is given" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.263"/>
58
- <testcase classname="multiform test validation e2e field specific validation js disabled" name="validation message doesn&#x27;t show when correct input is given" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/forms/multiform.test.js" time="0.134"/>
59
- <testcase classname="generate routes" name="handles a url with params" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/generate-routes.test.js" time="0.01"/>
60
- <testcase classname="generate routes" name="handles polish characters in the url" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/generate-routes.test.js" time="0.001"/>
61
- <testcase classname="generate routes" name="handles a url with params and diacritics" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/generate-routes.test.js" time="0.005"/>
62
- <testcase classname="generate routes" name="sorts routes from most specific first to least specific last, considering directory structure" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/generate-routes.test.js" time="0.001"/>
63
- <testcase classname="mountable-with-fields" name="properly types the getParsedValues method and respects required status" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/page/mountable-with-fields.test.js" time="0"/>
64
- <testcase classname="sealious-list test" name="creates minimal sealious app and adds a simple route that works" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/page/sealious-list.test.js" time="29.534"/>
65
- <testcase classname="stateful page" name="has types that allow for extracting action argument types" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/page/stateful-page.test.js" time="0"/>
66
- <testcase classname="stateful page" name="handles a basic case with action buttons" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/page/stateful-page.test.js" time="0"/>
67
- <testcase classname="register-external CLI commands package.json configuration" name="registers external controllers and verifies package.json is updated" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/register-external.test.js" time="19.565"/>
68
- <testcase classname="register-external CLI commands package.json configuration" name="registers external styles and verifies package.json is updated" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/register-external.test.js" time="17.792"/>
69
- <testcase classname="register-external CLI commands package.json configuration" name="registers both controllers and styles in the same project" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/register-external.test.js" time="22.799"/>
70
- <testcase classname="register-external CLI commands package.json configuration" name="handles duplicate registrations gracefully" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/register-external.test.js" time="22.786"/>
71
- <testcase classname="register-external CLI commands package.json configuration" name="preserves existing sealgen configuration when adding new entries" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/register-external.test.js" time="21.942"/>
72
- <testcase classname="register-external CLI commands build integration" name="registers external controllers and verifies they are included in build" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/register-external.test.js" time="22.953"/>
73
- <testcase classname="register-external CLI commands build integration" name="registers external styles and verifies they are included in build" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/register-external.test.js" time="29.347"/>
74
- <testcase classname="register-external CLI commands build integration" name="registers both external controllers and styles and verifies complete build integration" file="/home/kuba/projects/sealcode/superseal/repos/sealgen/lib-instrumented/register-external.test.js" time="29.435"/>
75
- </testsuite>
@@ -1,3 +0,0 @@
1
- export declare function addVerboseCRUD(params: Partial<{
2
- [key in "collection" | "url"]: string;
3
- }>, app_directory?: string): Promise<void>;
@@ -1,10 +0,0 @@
1
- import { Builder } from "./builder.js";
2
- export declare const COLORS_TS_PATH = "src/back/colors.ts";
3
- export declare const COLORS_CSS_PATH = "src/colors.css";
4
- export declare const COLORS_HTML_PATH = "public/dist/colors.html";
5
- export declare class ColorsBuilder extends Builder {
6
- getName(): string;
7
- ownsFile(file_path: string): file_path is "src/back/colors.ts";
8
- dispose(): Promise<void>;
9
- _build(): Promise<void>;
10
- }
@@ -1,7 +0,0 @@
1
- import { Builder } from "./builder.js";
2
- export declare class FontsBuilder extends Builder {
3
- getName(): string;
4
- ownsFile(file_path: string): file_path is "src/fonts.json";
5
- dispose(): Promise<void>;
6
- _build(): Promise<void>;
7
- }
@@ -1,6 +0,0 @@
1
- import { Controller } from "stimulus";
2
- export default class extends Controller {
3
- static targets: string[];
4
- defaultRowsNumber: number;
5
- addRow(): void;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- import Router from "@koa/router";
2
- import { Context } from "koa";
3
- import { Field, FieldsetOutput } from "sealious";
4
- import { FormField } from "../fields/field.js";
5
- import { StructuredArray as StructuredArrayField } from "../fields/structured-array.js";
6
- import { FormDataValue } from "../form-types.js";
7
- import { FormControl, FormControlContext } from "./form-control.js";
8
- import { FormFieldControl } from "./form-field-control.js";
9
- export type UnboundControlStorage<F extends {
10
- new (...args: any): FormFieldControl;
11
- } = {
12
- new (...args: any): FormFieldControl;
13
- }> = [F, string, ConstructorParameters<F>];
14
- export declare function UnboundControl<F extends {
15
- new (...args: any): FormFieldControl;
16
- }>(controlClass: F, arbitrary_field_name: string, params: ConstructorParameters<F>["1"]): UnboundControlStorage;
17
- export declare class StructuredArray<Subfields extends Record<string, Field<any>>> extends FormFieldControl {
18
- field: StructuredArrayField<Subfields>;
19
- item_controls: Array<FormControl | UnboundControlStorage>;
20
- constructor(field: StructuredArrayField<Subfields>, item_controls: Array<FormControl | UnboundControlStorage>);
21
- getFrameID(): string;
22
- getInnerFormID(): string;
23
- getActionURL(form_id?: string, action?: Record<string, unknown>): string;
24
- getDefaultItemBody(): Promise<{}>;
25
- makeSubfield(_field_name: string): FormField;
26
- 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>[]>;
27
- renderItem(ctx: Context, form_id: string, item: FieldsetOutput<Subfields>, index: number): Promise<string>;
28
- getItems(ctx: Context, raw_values: Record<string, FormDataValue>): Promise<FieldsetOutput<Subfields>[]>;
29
- _render(ctx: Context, form_id: string, raw_values: Record<string, FormDataValue>): Promise<string>;
30
- render(fctx: FormControlContext): Promise<string>;
31
- getTargetItemID(ctx: Context): Promise<string>;
32
- mount(router: Router): void;
33
- }
@@ -1,33 +0,0 @@
1
- import Router from "@koa/router";
2
- import { Context } from "koa";
3
- import { Field, FieldsetOutput } from "sealious";
4
- import { FormField } from "../fields/field.js";
5
- import { StructuredArray as StructuredArrayField } from "../fields/structured-array.js";
6
- import { FormDataValue } from "../form-types.js";
7
- import { FormControl, FormControlContext } from "./form-control.js";
8
- import { FormFieldControl } from "./form-field-control.js";
9
- export type UnboundControlStorage<F extends {
10
- new (...args: any): FormFieldControl;
11
- } = {
12
- new (...args: any): FormFieldControl;
13
- }> = [F, string, ConstructorParameters<F>];
14
- export declare function UnboundControl<F extends {
15
- new (...args: any): FormFieldControl;
16
- }>(controlClass: F, arbitrary_field_name: string, params: ConstructorParameters<F>["1"]): UnboundControlStorage;
17
- export declare class StructuredArray<Subfields extends Record<string, Field<any>>> extends FormFieldControl {
18
- field: StructuredArrayField<Subfields>;
19
- item_controls: Array<FormControl | UnboundControlStorage>;
20
- constructor(field: StructuredArrayField<Subfields>, item_controls: Array<FormControl | UnboundControlStorage>);
21
- getFrameID(): string;
22
- getInnerFormID(): string;
23
- getActionURL(form_id?: string, action?: Record<string, unknown>): string;
24
- getDefaultItemBody(): Promise<{}>;
25
- makeSubfield(_field_name: string): FormField;
26
- 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>[]>;
27
- renderItem(ctx: Context, form_id: string, item: FieldsetOutput<Subfields>, index: number): Promise<string>;
28
- getItems(ctx: Context, raw_values: Record<string, FormDataValue>): Promise<FieldsetOutput<Subfields>[]>;
29
- _render(ctx: Context, form_id: string, raw_values: Record<string, FormDataValue>): Promise<string>;
30
- render(fctx: FormControlContext): Promise<string>;
31
- getTargetItemID(ctx: Context): Promise<string>;
32
- mount(router: Router): void;
33
- }