@sealcode/sealgen 0.19.17 → 0.19.20
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/add-crud.test.d.ts +1 -0
- package/@types/controllers/sealgen-table.stimulus.d.ts +13 -0
- package/@types/forms/controls/table.d.ts +2 -0
- package/@types/index.d.ts +1 -0
- package/lib/controllers/sealgen-table.stimulus.js +98 -0
- package/lib/forms/controls/table.js +49 -43
- package/lib/generate-routes.js +11 -2
- package/lib/mount.js +8 -10
- package/lib/templates/form.js +2 -2
- package/lib/templates/jdd-editor.js +2 -0
- package/lib/templates/long-running-process.js +2 -0
- package/lib/templates/multiform.js +2 -0
- package/lib/templates/page.js +2 -0
- package/lib/templates/post.js +2 -0
- package/lib/templates/redirect.js +2 -0
- package/lib/templates/shared/collection-list.js +2 -1
- package/lib/templates/shared/item-delete.js +2 -0
- package/lib/templates/stateful-page.js +2 -0
- package/package.json +1 -1
- package/src/add-crud.test.ts +44 -0
- package/src/add-crud.ts +1 -1
- package/src/controllers/sealgen-table.stimulus.ts +115 -0
- package/src/forms/controls/table.ts +94 -81
- package/src/generate-routes.ts +13 -2
- package/src/index.ts +2 -0
- package/src/mount.ts +8 -12
- package/src/templates/form.ts +2 -2
- package/src/templates/jdd-editor.ts +2 -0
- package/src/templates/long-running-process.ts +2 -0
- package/src/templates/multiform.ts +2 -0
- package/src/templates/page.ts +2 -0
- package/src/templates/post.ts +2 -0
- package/src/templates/redirect.ts +2 -0
- package/src/templates/shared/collection-list.ts +2 -1
- package/src/templates/shared/item-delete.ts +2 -0
- package/src/templates/stateful-page.ts +2 -0
- package/lib/controllers/table-add-button.stimulus.js +0 -35
- package/src/controllers/table-add-button.stimulus.ts +0 -35
|
@@ -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
|
-
}
|