@sealcode/sealgen 0.18.8 → 0.19.0
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/.eslintrc.cjs +7 -2
- package/.xunit +75 -0
- package/@types/add-crud.d.sync-conflict-20250918-184311-TFDLWFG.ts +1 -0
- package/@types/builders/colors-builder.d.sync-conflict-20250918-184323-TFDLWFG.ts +10 -0
- package/@types/builders/colors-builder.d.ts +1 -1
- package/@types/builders/fonts-builder.d.sync-conflict-20250918-184322-TFDLWFG.ts +7 -0
- package/@types/builders/fonts-builder.d.ts +1 -1
- package/@types/controllers/table-add-button.d.ts +6 -0
- package/@types/controllers/table-add-button.stimulus.d.ts +6 -0
- package/@types/crud-field-snippets.d.sync-conflict-20250918-184323-TFDLWFG.ts +1 -0
- package/@types/crud-field-snippets.d.ts +1 -3
- package/@types/forms/controls/array.d.sync-conflict-20250918-184306-TFDLWFG.ts +33 -0
- package/@types/forms/controls/array.d.ts +1 -2
- package/@types/forms/controls/array.sync-conflict-20250918-222045-TFDLWFG.d.ts +33 -0
- package/@types/forms/controls/autocomplete.d.sync-conflict-20250918-222042-TFDLWFG.ts +22 -0
- package/@types/forms/controls/autocomplete.d.ts +1 -1
- package/@types/forms/controls/checkbox-group.d.sync-conflict-20250918-184319-TFDLWFG.ts +21 -0
- package/@types/forms/controls/checkbox-group.d.ts +3 -3
- package/@types/forms/controls/checkboxed-list-input.d.sync-conflict-20250918-184323-TFDLWFG.ts +21 -0
- package/@types/forms/controls/checkboxed-list-input.d.ts +3 -3
- package/@types/forms/controls/controls.d.ts +2 -2
- package/@types/forms/controls/derived-frame.d.sync-conflict-20250918-184314-TFDLWFG.ts +19 -0
- package/@types/forms/controls/derived-frame.d.ts +0 -1
- package/@types/forms/controls/dropdown.d.sync-conflict-20250918-222044-TFDLWFG.ts +30 -0
- package/@types/forms/controls/dropdown.d.ts +1 -1
- package/@types/forms/controls/file.d.sync-conflict-20250918-222045-TFDLWFG.ts +13 -0
- package/@types/forms/controls/file.d.ts +1 -2
- package/@types/forms/controls/form-control.d.sync-conflict-20250918-184322-TFDLWFG.ts +19 -0
- package/@types/forms/controls/form-control.d.sync-conflict-20250918-222046-TFDLWFG.ts +19 -0
- package/@types/forms/controls/form-control.d.ts +7 -3
- package/@types/forms/controls/image.d.ts +19 -0
- package/@types/forms/controls/image.test.d.ts +1 -0
- package/@types/forms/controls/multiple-files.d.sync-conflict-20250918-184318-TFDLWFG.ts +42 -0
- package/@types/forms/controls/multiple-files.d.ts +3 -0
- package/@types/forms/controls/multiple-images.d.ts +19 -0
- package/@types/forms/controls/number.d.sync-conflict-20250918-222046-TFDLWFG.ts +13 -0
- package/@types/forms/controls/number.d.ts +1 -1
- package/@types/forms/controls/photo.d.sync-conflict-20250918-184321-TFDLWFG.ts +19 -0
- package/@types/forms/controls/photo.d.ts +3 -5
- package/@types/forms/controls/simple-input.d.sync-conflict-20250918-184310-TFDLWFG.ts +33 -0
- package/@types/forms/controls/simple-input.d.sync-conflict-20250918-222042-TFDLWFG.ts +33 -0
- package/@types/forms/controls/simple-input.d.ts +5 -4
- package/@types/forms/controls/simple-input.sync-conflict-20250918-222045-TFDLWFG.d.ts +33 -0
- package/@types/forms/controls/single-reference.d.ts +3 -2
- package/@types/forms/controls/table.d.sync-conflict-20250918-184302-TFDLWFG.ts +39 -0
- package/@types/forms/controls/table.d.ts +8 -2
- package/@types/forms/controls/table.sync-conflict-20250918-222042-TFDLWFG.d.ts +39 -0
- package/@types/forms/controls/textarea.d.sync-conflict-20250918-222045-TFDLWFG.ts +25 -0
- package/@types/forms/controls/textarea.d.ts +3 -3
- package/@types/forms/fields/boolean.d.sync-conflict-20250918-184325-TFDLWFG.ts +22 -0
- package/@types/forms/fields/boolean.d.ts +6 -1
- package/@types/forms/fields/boolean.sync-conflict-20250918-222042-TFDLWFG.d.ts +22 -0
- package/@types/forms/fields/checkboxed-list.d.sync-conflict-20250918-184325-TFDLWFG.ts +23 -0
- package/@types/forms/fields/checkboxed-list.d.ts +3 -1
- package/@types/forms/fields/collection-field.d.sync-conflict-20250918-184319-TFDLWFG.ts +22 -0
- package/@types/forms/fields/collection-field.d.sync-conflict-20250918-222047-TFDLWFG.ts +22 -0
- package/@types/forms/fields/collection-field.d.ts +8 -1
- package/@types/forms/fields/color.d.ts +4 -0
- package/@types/forms/fields/coordinates.d.sync-conflict-20250918-222044-TFDLWFG.ts +14 -0
- package/@types/forms/fields/coordinates.d.ts +14 -0
- package/@types/forms/fields/date.d.ts +13 -0
- package/@types/forms/fields/datetime.d.sync-conflict-20250918-222050-TFDLWFG.ts +4 -0
- package/@types/forms/fields/datetime.d.ts +14 -0
- package/@types/forms/fields/deep-reverse-single-reference-list.d.ts +24 -0
- package/@types/forms/fields/deep-reverse-single-reference-table.d.ts +16 -0
- package/@types/forms/fields/email.d.sync-conflict-20250918-184303-TFDLWFG.ts +8 -0
- package/@types/forms/fields/email.d.ts +3 -0
- package/@types/forms/fields/enum-multiple-sealious.d.ts +16 -0
- package/@types/forms/fields/enum-multiple-sealious.sync-conflict-20250918-222047-TFDLWFG.d.ts +16 -0
- package/@types/forms/fields/field.d.sync-conflict-20250918-184306-TFDLWFG.ts +70 -0
- package/@types/forms/fields/field.d.ts +37 -5
- package/@types/forms/fields/fields.d.sync-conflict-20250918-184314-TFDLWFG.ts +29 -0
- package/@types/forms/fields/fields.d.ts +23 -8
- package/@types/forms/fields/file.d.sync-conflict-20250918-184310-TFDLWFG.ts +23 -0
- package/@types/forms/fields/file.d.sync-conflict-20250918-222046-TFDLWFG.ts +23 -0
- package/@types/forms/fields/file.d.ts +11 -5
- package/@types/forms/fields/file.sync-conflict-20250918-222049-TFDLWFG.d.ts +23 -0
- package/@types/forms/fields/float.d.ts +4 -0
- package/@types/forms/fields/get-field-for-sealious.d.sync-conflict-20250918-222046-TFDLWFG.ts +29 -0
- package/@types/forms/fields/get-field-for-sealious.d.ts +31 -0
- package/@types/forms/fields/get-field-for-sealious.sync-conflict-20250918-222042-TFDLWFG.d.ts +29 -0
- package/@types/forms/fields/html.d.ts +6 -0
- package/@types/forms/fields/image.d.sync-conflict-20250918-222042-TFDLWFG.ts +5 -0
- package/@types/forms/fields/image.d.ts +5 -0
- package/@types/forms/fields/int.d.ts +6 -0
- package/@types/forms/fields/json.d.ts +13 -0
- package/@types/forms/fields/markdown.d.ts +6 -0
- package/@types/forms/fields/multiple-files.d.sync-conflict-20250918-184304-TFDLWFG.ts +16 -0
- package/@types/forms/fields/multiple-files.d.ts +3 -1
- package/@types/forms/fields/number.d.sync-conflict-20250918-184317-TFDLWFG.ts +25 -0
- package/@types/forms/fields/number.d.sync-conflict-20250918-222047-TFDLWFG.ts +25 -0
- package/@types/forms/fields/number.d.ts +3 -1
- package/@types/forms/fields/password.d.ts +6 -0
- package/@types/forms/fields/pick-from-list-sealious.d.ts +11 -0
- package/@types/forms/fields/pick-from-list.d.sync-conflict-20250918-184322-TFDLWFG.ts +15 -0
- package/@types/forms/fields/pick-from-list.d.ts +4 -3
- package/@types/forms/fields/proxy-field.d.sync-conflict-20250918-184307-TFDLWFG.ts +15 -0
- package/@types/forms/fields/proxy-field.d.ts +3 -1
- package/@types/forms/fields/regexp.d.sync-conflict-20250918-184305-TFDLWFG.ts +21 -0
- package/@types/forms/fields/regexp.d.sync-conflict-20250918-222045-TFDLWFG.ts +21 -0
- package/@types/forms/fields/regexp.d.ts +6 -1
- package/@types/forms/fields/regexp.sync-conflict-20250918-222047-TFDLWFG.d.ts +21 -0
- package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-184309-TFDLWFG.ts +29 -0
- package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-222044-TFDLWFG.ts +29 -0
- package/@types/forms/fields/simple-form-field.d.ts +23 -3
- package/@types/forms/fields/simple-form-field.sync-conflict-20250918-222049-TFDLWFG.d.ts +29 -0
- package/@types/forms/fields/single-reference.d.ts +19 -0
- package/@types/forms/fields/single-reference.sync-conflict-20250918-222043-TFDLWFG.d.ts +10 -0
- package/@types/forms/fields/structured-array.d.sync-conflict-20250918-184302-TFDLWFG.ts +27 -0
- package/@types/forms/fields/structured-array.d.sync-conflict-20250918-222049-TFDLWFG.ts +27 -0
- package/@types/forms/fields/structured-array.d.ts +19 -10
- package/@types/forms/fields/structured-array.sync-conflict-20250918-222047-TFDLWFG.d.ts +27 -0
- package/@types/forms/fields/table.d.sync-conflict-20250918-184303-TFDLWFG.ts +16 -0
- package/@types/forms/fields/table.d.ts +3 -0
- package/@types/forms/fields/text.d.ts +6 -0
- package/@types/forms/fields/url.d.ts +6 -0
- package/@types/forms/form-types.d.sync-conflict-20250918-222045-TFDLWFG.ts +26 -0
- package/@types/forms/form-types.d.ts +2 -0
- package/@types/forms/form.d.sync-conflict-20250918-184315-TFDLWFG.ts +32 -0
- package/@types/forms/form.d.sync-conflict-20250918-222049-TFDLWFG.ts +32 -0
- package/@types/forms/form.d.ts +10 -7
- package/@types/forms/form.sync-conflict-20250918-222049-TFDLWFG.d.ts +33 -0
- package/@types/forms/form.test.d.sync-conflict-20250918-184318-TFDLWFG.ts +6 -0
- package/@types/forms/form.test.d.sync-conflict-20250918-222047-TFDLWFG.ts +6 -0
- package/@types/forms/form.test.d.ts +2 -2
- package/@types/forms/multiform.d.sync-conflict-20250918-184308-TFDLWFG.ts +23 -0
- package/@types/forms/multiform.d.ts +1 -1
- package/@types/forms/multiform.sync-conflict-20250918-222044-TFDLWFG.d.ts +23 -0
- package/@types/index.d.sync-conflict-20250918-184316-TFDLWFG.ts +46 -0
- package/@types/index.d.ts +2 -2
- package/@types/mount.d.sync-conflict-20250918-184320-TFDLWFG.ts +6 -0
- package/@types/page/list.d.sync-conflict-20250918-184318-TFDLWFG.ts +48 -0
- package/@types/page/list.d.sync-conflict-20250918-222046-TFDLWFG.ts +48 -0
- package/@types/page/list.d.ts +2 -2
- package/@types/page/list.sync-conflict-20250918-222048-TFDLWFG.d.ts +48 -0
- package/@types/page/mountable-with-fields.d.sync-conflict-20250918-184321-TFDLWFG.ts +42 -0
- package/@types/page/mountable-with-fields.d.sync-conflict-20250918-222046-TFDLWFG.ts +42 -0
- package/@types/page/mountable-with-fields.d.ts +3 -3
- package/@types/page/mountable-with-fields.sync-conflict-20250918-222044-TFDLWFG.d.ts +42 -0
- package/@types/page/mountable.d.sync-conflict-20250918-184306-TFDLWFG.ts +10 -0
- package/@types/page/page.d.sync-conflict-20250918-184320-TFDLWFG.ts +18 -0
- package/@types/page/props-parser.d.sync-conflict-20250918-184305-TFDLWFG.ts +15 -0
- package/@types/page/props-parser.d.ts +0 -1
- package/@types/page/stateful-page.d.sync-conflict-20250918-184326-TFDLWFG.ts +62 -0
- package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts +1 -0
- package/@types/templates/shared/shared-crud-form-fields.d.ts +0 -67
- package/@types/test_utils/test-on-real-app.d.sync-conflict-20250918-184320-TFDLWFG.ts +26 -0
- package/@types/test_utils/test-on-real-app.d.ts +0 -1
- package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts +18 -0
- package/@types/utils/extract-fields-from-collection.d.ts +5 -1
- package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts +18 -0
- package/@types/utils/wrap-attributes.d.ts +3 -0
- package/README.md +5 -0
- package/assets/file-icon.svg +5 -0
- package/lib/add-crud.js +80 -89
- package/lib/add-list-route.test.js +1 -1
- package/lib/add-route.js +0 -7
- package/lib/build.js +3 -1
- package/lib/cli.js +2 -5
- package/lib/controllers/table-add-button.stimulus.js +35 -0
- package/lib/forms/controls/array.js +20 -16
- package/lib/forms/controls/big-radio-group.js +2 -2
- package/lib/forms/controls/checkbox-group.js +7 -7
- package/lib/forms/controls/checkboxed-list-input.js +9 -2
- package/lib/forms/controls/controls.js +2 -2
- package/lib/forms/controls/derived-frame.js +5 -1
- package/lib/forms/controls/derived.js +1 -1
- package/lib/forms/controls/dropdown.js +4 -1
- package/lib/forms/controls/editable-collection-subset.js +2 -2
- package/lib/forms/controls/file.js +26 -2
- package/lib/forms/controls/file.test.js +2 -2
- package/lib/forms/controls/hidden-input.js +4 -1
- package/lib/forms/controls/{photo.js → image.js} +6 -7
- package/lib/forms/controls/{photo.test.js → image.test.js} +6 -21
- package/lib/forms/controls/multiple-files.js +10 -1
- package/lib/forms/controls/{multiple-photos.js → multiple-images.js} +3 -3
- package/lib/forms/controls/simple-input.js +13 -12
- package/lib/forms/controls/single-reference.js +4 -0
- package/lib/forms/controls/table.js +66 -24
- package/lib/forms/controls/textarea.js +4 -2
- package/lib/forms/controls/tickable.js +13 -5
- package/lib/forms/fields/boolean.js +14 -0
- package/lib/forms/fields/checkboxed-list.js +4 -0
- package/lib/forms/fields/collection-field.js +9 -0
- package/lib/forms/fields/color.js +10 -0
- package/lib/forms/fields/coordinates.js +49 -0
- package/lib/forms/fields/date.js +34 -0
- package/lib/forms/fields/datetime.js +46 -0
- package/lib/forms/fields/deep-reverse-single-reference-list.js +81 -0
- package/lib/forms/fields/deep-reverse-single-reference-table.js +122 -0
- package/lib/forms/fields/email.js +7 -0
- package/lib/forms/fields/enum-multiple-sealious.js +32 -0
- package/lib/forms/fields/field.js +32 -4
- package/lib/forms/fields/field.test.js +5 -5
- package/lib/forms/fields/fields.js +23 -8
- package/lib/forms/fields/file.js +33 -9
- package/lib/forms/fields/file.test.js +4 -16
- package/lib/forms/fields/float.js +10 -0
- package/lib/forms/fields/get-field-for-sealious.js +213 -0
- package/lib/forms/fields/html.js +14 -0
- package/lib/forms/fields/image.js +13 -0
- package/lib/forms/fields/int.js +23 -0
- package/lib/forms/fields/json.js +31 -0
- package/lib/forms/fields/markdown.js +14 -0
- package/lib/forms/fields/multiple-files.js +4 -0
- package/lib/forms/fields/number.js +6 -0
- package/lib/forms/fields/password.js +13 -0
- package/lib/forms/fields/pick-from-list-sealious.js +17 -0
- package/lib/forms/fields/pick-from-list.js +6 -2
- package/lib/forms/fields/proxy-field.js +3 -0
- package/lib/forms/fields/regexp.js +14 -0
- package/lib/forms/fields/simple-form-field.js +60 -2
- package/lib/forms/fields/single-reference.js +44 -0
- package/lib/forms/fields/structured-array.js +63 -12
- package/lib/forms/fields/table.js +28 -1
- package/lib/forms/fields/text.js +17 -0
- package/lib/forms/fields/url.js +17 -0
- package/lib/forms/form.js +30 -13
- package/lib/forms/form.test.js +3 -4
- package/lib/forms/multiform.js +4 -2
- package/lib/forms/multiform.test.js +3 -3
- package/lib/generate-stimulus.js +1 -0
- package/lib/index.js +1 -0
- package/lib/make-hidden-inputs.js +1 -1
- package/lib/mount.js +11 -0
- package/lib/notifier.js +0 -1
- package/lib/page/list.js +15 -8
- package/lib/page/mountable-with-fields.js +14 -6
- package/lib/page/mountable-with-fields.test.js +1 -1
- package/lib/templates/form.js +8 -9
- package/lib/templates/multiform.js +4 -4
- package/lib/templates/page.js +0 -2
- package/lib/templates/shared/collection-create-form.js +28 -40
- package/lib/templates/shared/collection-edit-form.js +40 -77
- package/lib/templates/shared/collection-list.js +12 -20
- package/lib/templates/shared/shared-crud-form-fields.js +27 -95
- package/lib/test_utils/test-on-real-app.js +3 -3
- package/lib/utils/extract-fields-from-collection.js +60 -20
- package/lib/utils/make-slug.js +1 -1
- package/lib/utils/wrap-attributes.js +20 -0
- package/package.json +5 -4
- package/src/add-crud.ts +86 -97
- package/src/add-list-route.test.ts +1 -1
- package/src/add-route.ts +0 -7
- package/src/build.ts +3 -1
- package/src/cli.ts +3 -5
- package/src/controllers/table-add-button.stimulus.ts +35 -0
- package/src/forms/controls/array.ts +23 -20
- package/src/forms/controls/autocomplete.ts +1 -1
- package/src/forms/controls/big-radio-group.ts +2 -2
- package/src/forms/controls/checkbox-group.ts +9 -9
- package/src/forms/controls/checkboxed-list-input.ts +27 -15
- package/src/forms/controls/controls.ts +2 -2
- package/src/forms/controls/derived-frame.ts +5 -1
- package/src/forms/controls/derived.ts +1 -1
- package/src/forms/controls/dropdown.ts +5 -2
- package/src/forms/controls/editable-collection-subset.ts +2 -2
- package/src/forms/controls/file.test.ts +4 -2
- package/src/forms/controls/file.ts +31 -5
- package/src/forms/controls/form-control.ts +7 -2
- package/src/forms/controls/hidden-input.ts +4 -1
- package/src/forms/controls/{photo.test.ts → image.test.ts} +5 -22
- package/src/forms/controls/{photo.ts → image.ts} +3 -5
- package/src/forms/controls/multiple-files.ts +18 -1
- package/src/forms/controls/{multiple-photos.ts → multiple-images.ts} +1 -1
- package/src/forms/controls/number.ts +1 -1
- package/src/forms/controls/simple-input.ts +18 -34
- package/src/forms/controls/single-reference.ts +10 -2
- package/src/forms/controls/table.ts +90 -31
- package/src/forms/controls/textarea.ts +6 -4
- package/src/forms/controls/tickable.ts +13 -5
- package/src/forms/fields/boolean.ts +23 -1
- package/src/forms/fields/checkboxed-list.ts +11 -2
- package/src/forms/fields/collection-field.ts +16 -1
- package/src/forms/fields/color.ts +9 -0
- package/src/forms/fields/coordinates.ts +66 -0
- package/src/forms/fields/date.ts +50 -0
- package/src/forms/fields/datetime.ts +66 -0
- package/src/forms/fields/deep-reverse-single-reference-list.ts +136 -0
- package/src/forms/fields/deep-reverse-single-reference-table.ts +213 -0
- package/src/forms/fields/email.ts +9 -0
- package/src/forms/fields/enum-multiple-sealious.ts +48 -0
- package/src/forms/fields/field.test.ts +5 -5
- package/src/forms/fields/field.ts +94 -8
- package/src/forms/fields/fields.ts +23 -8
- package/src/forms/fields/file.test.ts +4 -16
- package/src/forms/fields/file.ts +43 -15
- package/src/forms/fields/float.ts +9 -0
- package/src/forms/fields/get-field-for-sealious.ts +304 -0
- package/src/forms/fields/html.ts +15 -0
- package/src/forms/fields/image.ts +12 -0
- package/src/forms/fields/int.ts +25 -0
- package/src/forms/fields/json.ts +48 -0
- package/src/forms/fields/markdown.ts +15 -0
- package/src/forms/fields/multiple-files.ts +10 -1
- package/src/forms/fields/number.ts +8 -1
- package/src/forms/fields/password.ts +17 -0
- package/src/forms/fields/pick-from-list-sealious.ts +22 -0
- package/src/forms/fields/pick-from-list.ts +7 -3
- package/src/forms/fields/proxy-field.ts +6 -1
- package/src/forms/fields/regexp.ts +27 -1
- package/src/forms/fields/simple-form-field.ts +95 -7
- package/src/forms/fields/single-reference.ts +62 -0
- package/src/forms/fields/structured-array.ts +115 -18
- package/src/forms/fields/table.ts +32 -1
- package/src/forms/fields/text.ts +18 -0
- package/src/forms/fields/url.ts +20 -0
- package/src/forms/form-types.ts +2 -0
- package/src/forms/form.test.ts +3 -4
- package/src/forms/form.ts +37 -16
- package/src/forms/forms.css +0 -85
- package/src/forms/multiform.test.ts +3 -3
- package/src/forms/multiform.ts +2 -0
- package/src/generate-stimulus.ts +1 -0
- package/src/index.ts +2 -1
- package/src/make-hidden-inputs.ts +1 -1
- package/src/mount.ts +14 -0
- package/src/notifier.ts +0 -1
- package/src/page/list.ts +15 -8
- package/src/page/mountable-with-fields.test.ts +1 -1
- package/src/page/mountable-with-fields.ts +18 -9
- package/src/register-external.ts +1 -1
- package/src/templates/form.ts +8 -9
- package/src/templates/multiform.ts +4 -4
- package/src/templates/page.ts +0 -2
- package/src/templates/shared/collection-create-form.ts +30 -66
- package/src/templates/shared/collection-edit-form.ts +41 -102
- package/src/templates/shared/collection-list.ts +12 -20
- package/src/templates/shared/item-delete.ts +0 -1
- package/src/templates/shared/shared-crud-form-fields.ts +37 -171
- package/src/test_utils/test-on-real-app.ts +4 -3
- package/src/utils/extract-fields-from-collection.ts +76 -25
- package/src/utils/make-slug.ts +1 -1
- package/src/utils/wrap-attributes.ts +17 -0
- package/lib/add-verbose-crud.js +0 -119
- package/lib/crud-field-snippets.js +0 -52
- package/lib/find-css-includes.js +0 -3
- package/lib/forms/controls/reverse-single-reference.js +0 -1
- package/lib/forms/fields/enum-multiple.js +0 -47
- package/lib/forms/fields/enum-multiple.test.js +0 -27
- package/lib/forms/fields/enum.js +0 -41
- package/lib/forms/fields/enum.test.js +0 -21
- package/lib/forms/fields/reverse-single-reference.js +0 -17
- package/lib/templates/shared/handlers/boolean.js +0 -14
- package/lib/templates/shared/handlers/date.js +0 -8
- package/lib/templates/shared/handlers/deep-reverse-single-reference.js +0 -209
- package/lib/templates/shared/handlers/default.js +0 -49
- package/lib/templates/shared/handlers/enum.js +0 -19
- package/lib/templates/shared/handlers/file.js +0 -23
- package/lib/templates/shared/handlers/image.js +0 -32
- package/lib/templates/shared/handlers/int.js +0 -11
- package/lib/templates/shared/handlers/jdd.js +0 -10
- package/lib/templates/shared/handlers/single-reference.js +0 -12
- package/lib/templates/shared/handlers/structured-array.js +0 -33
- package/src/add-verbose-crud.ts +0 -138
- package/src/crud-field-snippets.ts +0 -57
- package/src/find-css-includes.ts +0 -3
- package/src/forms/controls/reverse-single-reference.ts +0 -50
- package/src/forms/fields/enum-multiple.test.ts +0 -31
- package/src/forms/fields/enum-multiple.ts +0 -62
- package/src/forms/fields/enum.test.ts +0 -25
- package/src/forms/fields/enum.ts +0 -56
- package/src/forms/fields/reverse-single-reference.ts +0 -20
- package/src/templates/shared/handlers/boolean.ts +0 -18
- package/src/templates/shared/handlers/date.ts +0 -12
- package/src/templates/shared/handlers/deep-reverse-single-reference.ts +0 -244
- package/src/templates/shared/handlers/default.ts +0 -64
- package/src/templates/shared/handlers/enum.ts +0 -23
- package/src/templates/shared/handlers/file.ts +0 -27
- package/src/templates/shared/handlers/image.ts +0 -45
- package/src/templates/shared/handlers/int.ts +0 -15
- package/src/templates/shared/handlers/jdd.ts +0 -14
- package/src/templates/shared/handlers/single-reference.ts +0 -16
- package/src/templates/shared/handlers/structured-array.ts +0 -42
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Router from "@koa/router";
|
|
2
|
+
import { Collection, CollectionItem, Field as SealiousField } from "sealious";
|
|
3
|
+
import { Context } from "koa";
|
|
4
|
+
import { FlatTemplatable } from "tempstream";
|
|
5
|
+
import { MultipleFiles as MultipleFilesField } from "../fields/multiple-files.js";
|
|
6
|
+
import { FormFieldControl } from "./form-field-control.js";
|
|
7
|
+
import { FormControlContext } from "./form-control.js";
|
|
8
|
+
import { FilePointer } from "@sealcode/file-manager";
|
|
9
|
+
export type MultipleFilesOptions = {
|
|
10
|
+
label?: string;
|
|
11
|
+
uploadLabel?: string;
|
|
12
|
+
getAdditionalFields: (ctx: Context, file: FilePointer) => Promise<Record<string, unknown>>;
|
|
13
|
+
};
|
|
14
|
+
export declare class MultipleFiles extends FormFieldControl {
|
|
15
|
+
field: MultipleFilesField;
|
|
16
|
+
options: MultipleFilesOptions;
|
|
17
|
+
constructor(field: MultipleFilesField, options?: Partial<MultipleFilesOptions>);
|
|
18
|
+
getClassModifiers(): string[];
|
|
19
|
+
mount(router: Router): void;
|
|
20
|
+
deleteFileAssociation(ctx: Context, file_item_id: string): Promise<void>;
|
|
21
|
+
addFileAssociation(ctx: Context, file: FilePointer): Promise<void>;
|
|
22
|
+
getFrameRelativeURL(): string;
|
|
23
|
+
getFrameID(): string;
|
|
24
|
+
renderFrame(_ctx: Context, content?: FlatTemplatable): string | Promise<string>;
|
|
25
|
+
render(fctx: FormControlContext): FlatTemplatable | Promise<FlatTemplatable>;
|
|
26
|
+
getReferencingCollection(): Collection;
|
|
27
|
+
getFileField(): SealiousField<any> | null;
|
|
28
|
+
extractFileFromItem(item: CollectionItem<Collection>): Promise<FilePointer | null>;
|
|
29
|
+
renderFileItemPreview(_fileItem: CollectionItem, file: FilePointer): Promise<FlatTemplatable>;
|
|
30
|
+
renderFileItem(fileItem: CollectionItem, file: FilePointer): Promise<FlatTemplatable>;
|
|
31
|
+
renderFileRemoveButton(fileItem: CollectionItem): FlatTemplatable;
|
|
32
|
+
getFileItems(ctx: Context): Promise<CollectionItem<any>[]>;
|
|
33
|
+
getInputAttributes(): {
|
|
34
|
+
type: string;
|
|
35
|
+
name: string;
|
|
36
|
+
multiple: boolean;
|
|
37
|
+
};
|
|
38
|
+
renderFrameContent(ctx: Context): Promise<FlatTemplatable>;
|
|
39
|
+
setLabel(label: string): void;
|
|
40
|
+
setUploadLabel(label: string): void;
|
|
41
|
+
setAdditionalFieldsGetter(fn: (ctx: Context, file: FilePointer) => Promise<Record<string, unknown>>): void;
|
|
42
|
+
}
|
|
@@ -36,4 +36,7 @@ export declare class MultipleFiles extends FormFieldControl {
|
|
|
36
36
|
multiple: boolean;
|
|
37
37
|
};
|
|
38
38
|
renderFrameContent(ctx: Context): Promise<FlatTemplatable>;
|
|
39
|
+
setLabel(label: string): void;
|
|
40
|
+
setUploadLabel(label: string): void;
|
|
41
|
+
setAdditionalFieldsGetter(fn: (ctx: Context, file: FilePointer) => Promise<Record<string, unknown>>): void;
|
|
39
42
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CollectionItem } from "sealious";
|
|
2
|
+
import { FilePointer } from "@sealcode/file-manager";
|
|
3
|
+
import { FlatTemplatable } from "tempstream";
|
|
4
|
+
import { MultipleFiles, MultipleFilesOptions } from "./multiple-files.js";
|
|
5
|
+
import { MultipleFiles as MultipleFilesField } from "../fields/multiple-files.js";
|
|
6
|
+
import { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
7
|
+
export declare class MultipleImages extends MultipleFiles {
|
|
8
|
+
field: MultipleFilesField;
|
|
9
|
+
imageRouter: KoaResponsiveImageRouter;
|
|
10
|
+
constructor(field: MultipleFilesField, imageRouter: KoaResponsiveImageRouter, options?: Partial<MultipleFilesOptions>);
|
|
11
|
+
getClassModifiers(): string[];
|
|
12
|
+
getInputAttributes(): {
|
|
13
|
+
accept: string;
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
multiple: boolean;
|
|
17
|
+
};
|
|
18
|
+
renderFileItem(fileItem: CollectionItem, file: FilePointer): Promise<FlatTemplatable>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NumberField } from "../fields/number.js";
|
|
2
|
+
import { FormControlContext } from "./form-control.js";
|
|
3
|
+
import { SimpleInput, SimpleInputOptions } from "./simple-input.js";
|
|
4
|
+
export type NumberOptions = SimpleInputOptions & Partial<{
|
|
5
|
+
step: number;
|
|
6
|
+
}>;
|
|
7
|
+
export declare class Number extends SimpleInput<number | null> {
|
|
8
|
+
field: NumberField;
|
|
9
|
+
options: NumberOptions;
|
|
10
|
+
constructor(field: NumberField, options: NumberOptions);
|
|
11
|
+
getType(): string;
|
|
12
|
+
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
13
|
+
}
|
|
@@ -4,7 +4,7 @@ import { SimpleInput, SimpleInputOptions } from "./simple-input.js";
|
|
|
4
4
|
export type NumberOptions = SimpleInputOptions & Partial<{
|
|
5
5
|
step: number;
|
|
6
6
|
}>;
|
|
7
|
-
export declare class Number extends SimpleInput
|
|
7
|
+
export declare class Number extends SimpleInput {
|
|
8
8
|
field: NumberField;
|
|
9
9
|
options: NumberOptions;
|
|
10
10
|
constructor(field: NumberField, options: NumberOptions);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { FlatTemplatable } from "tempstream";
|
|
3
|
+
import { File } from "./file.js";
|
|
4
|
+
import { FormField } from "../fields/field.js";
|
|
5
|
+
import { SimpleInputOptions } from "./simple-input.js";
|
|
6
|
+
import { FormControlContext } from "./form-control.js";
|
|
7
|
+
import { FileContainer } from "../fields/file.js";
|
|
8
|
+
import { FilePointer } from "@sealcode/file-manager";
|
|
9
|
+
export declare class Photo extends File {
|
|
10
|
+
field: FormField<boolean, FileContainer>;
|
|
11
|
+
constructor(field: FormField<boolean, FileContainer>, options?: SimpleInputOptions);
|
|
12
|
+
getImgStyle(): Promise<string>;
|
|
13
|
+
renderFilePreview(ctx: Context, file: FilePointer | null): Promise<FlatTemplatable>;
|
|
14
|
+
getWrapperModifiers(): string[];
|
|
15
|
+
getInputAttributes(fctx: FormControlContext): Promise<{
|
|
16
|
+
accept: string;
|
|
17
|
+
onchange: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
@@ -5,14 +5,12 @@ import { FormField } from "../fields/field.js";
|
|
|
5
5
|
import { SimpleInputOptions } from "./simple-input.js";
|
|
6
6
|
import { FormControlContext } from "./form-control.js";
|
|
7
7
|
import { FileContainer } from "../fields/file.js";
|
|
8
|
-
import { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
9
8
|
import { FilePointer } from "@sealcode/file-manager";
|
|
10
|
-
export declare class
|
|
9
|
+
export declare class Image extends File {
|
|
11
10
|
field: FormField<boolean, FileContainer>;
|
|
12
|
-
|
|
13
|
-
constructor(field: FormField<boolean, FileContainer>, imageRouter: KoaResponsiveImageRouter, options?: SimpleInputOptions);
|
|
11
|
+
constructor(field: FormField<boolean, FileContainer>, options?: SimpleInputOptions);
|
|
14
12
|
getImgStyle(): Promise<string>;
|
|
15
|
-
renderFilePreview(
|
|
13
|
+
renderFilePreview(ctx: Context, file: FilePointer | null): Promise<FlatTemplatable>;
|
|
16
14
|
getWrapperModifiers(): string[];
|
|
17
15
|
getInputAttributes(fctx: FormControlContext): Promise<{
|
|
18
16
|
accept: string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { FlatTemplatable } from "tempstream";
|
|
3
|
+
import { FormField } from "../fields/field.js";
|
|
4
|
+
import { FormDataValue } from "../form-types.js";
|
|
5
|
+
import { FormControlContext } from "./form-control.js";
|
|
6
|
+
import { FormFieldControl } from "./form-field-control.js";
|
|
7
|
+
export type SimpleInputOptions = {
|
|
8
|
+
id?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
autocomplete?: boolean;
|
|
11
|
+
hide_errors?: boolean;
|
|
12
|
+
type?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
step?: number;
|
|
17
|
+
suffix?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class SimpleInput<ParsedValue, Options extends SimpleInputOptions = SimpleInputOptions> extends FormFieldControl {
|
|
20
|
+
field: FormField<boolean, ParsedValue>;
|
|
21
|
+
options: SimpleInputOptions;
|
|
22
|
+
constructor(field: FormField<boolean, ParsedValue>, options?: Options);
|
|
23
|
+
preInput(_ctx: FormControlContext, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
24
|
+
getType(): string;
|
|
25
|
+
getLabel(): string;
|
|
26
|
+
getID(): string;
|
|
27
|
+
getPlaceholder(): string;
|
|
28
|
+
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
29
|
+
postInput(_: Context): Promise<FlatTemplatable>;
|
|
30
|
+
renderInput(_ctx: Context, attributes_str: string, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
31
|
+
getWrapperModifiers(): string[];
|
|
32
|
+
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { FlatTemplatable } from "tempstream";
|
|
3
|
+
import { FormField } from "../fields/field.js";
|
|
4
|
+
import { FormDataValue } from "../form-types.js";
|
|
5
|
+
import { FormControlContext } from "./form-control.js";
|
|
6
|
+
import { FormFieldControl } from "./form-field-control.js";
|
|
7
|
+
export type SimpleInputOptions = {
|
|
8
|
+
id?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
autocomplete?: boolean;
|
|
11
|
+
hide_errors?: boolean;
|
|
12
|
+
type?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
step?: number;
|
|
17
|
+
suffix?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class SimpleInput<ParsedValue, Options extends SimpleInputOptions = SimpleInputOptions> extends FormFieldControl {
|
|
20
|
+
field: FormField<boolean, ParsedValue>;
|
|
21
|
+
options: SimpleInputOptions;
|
|
22
|
+
constructor(field: FormField<boolean, ParsedValue>, options?: Options);
|
|
23
|
+
preInput(_ctx: FormControlContext, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
24
|
+
getType(): string;
|
|
25
|
+
getLabel(): string;
|
|
26
|
+
getID(): string;
|
|
27
|
+
getPlaceholder(): string;
|
|
28
|
+
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
29
|
+
postInput(_: Context): Promise<FlatTemplatable>;
|
|
30
|
+
renderInput(_ctx: Context, attributes_str: string, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
31
|
+
getWrapperModifiers(): string[];
|
|
32
|
+
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
33
|
+
}
|
|
@@ -9,17 +9,18 @@ export type SimpleInputOptions = {
|
|
|
9
9
|
label?: string;
|
|
10
10
|
autocomplete?: boolean;
|
|
11
11
|
hide_errors?: boolean;
|
|
12
|
-
type?:
|
|
12
|
+
type?: string;
|
|
13
13
|
value?: string;
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
readonly?: boolean;
|
|
16
16
|
step?: number;
|
|
17
17
|
suffix?: string;
|
|
18
|
+
pattern?: string;
|
|
18
19
|
};
|
|
19
|
-
export declare class SimpleInput<
|
|
20
|
-
field: FormField<boolean,
|
|
20
|
+
export declare class SimpleInput<Options extends SimpleInputOptions = SimpleInputOptions> extends FormFieldControl {
|
|
21
|
+
field: FormField<boolean, any>;
|
|
21
22
|
options: SimpleInputOptions;
|
|
22
|
-
constructor(field: FormField<boolean,
|
|
23
|
+
constructor(field: FormField<boolean, any>, options?: Options);
|
|
23
24
|
preInput(_ctx: FormControlContext, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
24
25
|
getType(): string;
|
|
25
26
|
getLabel(): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { FlatTemplatable } from "tempstream";
|
|
3
|
+
import { FormField } from "../fields/field.js";
|
|
4
|
+
import { FormDataValue } from "../form-types.js";
|
|
5
|
+
import { FormControlContext } from "./form-control.js";
|
|
6
|
+
import { FormFieldControl } from "./form-field-control.js";
|
|
7
|
+
export type SimpleInputOptions = {
|
|
8
|
+
id?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
autocomplete?: boolean;
|
|
11
|
+
hide_errors?: boolean;
|
|
12
|
+
type?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
step?: number;
|
|
17
|
+
suffix?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class SimpleInput<ParsedValue, Options extends SimpleInputOptions = SimpleInputOptions> extends FormFieldControl {
|
|
20
|
+
field: FormField<boolean, ParsedValue>;
|
|
21
|
+
options: SimpleInputOptions;
|
|
22
|
+
constructor(field: FormField<boolean, ParsedValue>, options?: Options);
|
|
23
|
+
preInput(_ctx: FormControlContext, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
24
|
+
getType(): string;
|
|
25
|
+
getLabel(): string;
|
|
26
|
+
getID(): string;
|
|
27
|
+
getPlaceholder(): string;
|
|
28
|
+
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
29
|
+
postInput(_: Context): Promise<FlatTemplatable>;
|
|
30
|
+
renderInput(_ctx: Context, attributes_str: string, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
31
|
+
getWrapperModifiers(): string[];
|
|
32
|
+
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
33
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FieldTypes as SealiousFieldTypes } from "sealious";
|
|
2
2
|
import { CollectionField } from "../fields/collection-field.js";
|
|
3
3
|
import { DropdownOptions, FreeformDropdown } from "./dropdown.js";
|
|
4
4
|
import { Collection, CollectionItem } from "sealious";
|
|
5
|
-
export declare class SingleReferenceDropdown<F extends
|
|
5
|
+
export declare class SingleReferenceDropdown<TargetCollection extends Collection, F extends SealiousFieldTypes.SingleReference, Required extends boolean> extends FreeformDropdown {
|
|
6
6
|
field: CollectionField<F, Required>;
|
|
7
7
|
options: DropdownOptions & {
|
|
8
8
|
getLabel?: (item: CollectionItem<Collection>) => string;
|
|
@@ -10,4 +10,5 @@ export declare class SingleReferenceDropdown<F extends SealiousSingleReference,
|
|
|
10
10
|
constructor(field: CollectionField<F, Required>, options?: DropdownOptions & {
|
|
11
11
|
getLabel?: (item: CollectionItem<Collection>) => string;
|
|
12
12
|
});
|
|
13
|
+
setOptionLabelGetter(getter: (item: CollectionItem<TargetCollection>) => string): this;
|
|
13
14
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Router from "@koa/router";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
import { FlatTemplatable } from "tempstream";
|
|
4
|
+
import { FormField } from "../fields/field.js";
|
|
5
|
+
import { Table as TableField } from "../fields/table.js";
|
|
6
|
+
import { Form } from "../form.js";
|
|
7
|
+
import { FormControl, FormControlContext } from "./form-control.js";
|
|
8
|
+
export type TableControlOptions<F extends Record<string, FormField>> = {
|
|
9
|
+
render_fields: {
|
|
10
|
+
[field_name in keyof F]: (fctx: FormControlContext, name: string, value: string) => FlatTemplatable | Promise<FlatTemplatable>;
|
|
11
|
+
};
|
|
12
|
+
allow_removing?: boolean;
|
|
13
|
+
label_add?: string;
|
|
14
|
+
label: string;
|
|
15
|
+
label_remove?: string;
|
|
16
|
+
} & ({
|
|
17
|
+
allow_adding: false;
|
|
18
|
+
} | {
|
|
19
|
+
allow_adding: true;
|
|
20
|
+
make_new_row: (ctx: Context) => Promise<{
|
|
21
|
+
[field_name in keyof F]: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
});
|
|
24
|
+
export declare const TABLE_COLUMN_FIELD_INDEX_PLACEHOLDER = "____$$$$";
|
|
25
|
+
export declare class Table<F extends Record<string, FormField>> extends FormControl {
|
|
26
|
+
table_field: TableField<F>;
|
|
27
|
+
options: TableControlOptions<F>;
|
|
28
|
+
role: "input";
|
|
29
|
+
constructor(table_field: TableField<F>, options: TableControlOptions<F>);
|
|
30
|
+
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
31
|
+
getFrameID(): string;
|
|
32
|
+
getActionURL(field_name: string, action: Record<string, unknown>): string;
|
|
33
|
+
mount(router: Router, form: Form<any, any>): void;
|
|
34
|
+
setAllowRemoving(value: boolean): this;
|
|
35
|
+
setAllowAdding(value: boolean): this;
|
|
36
|
+
setLabel(value: string): this;
|
|
37
|
+
setRemoveLabel(value: string): this;
|
|
38
|
+
setAddLabel(value: string): this;
|
|
39
|
+
}
|
|
@@ -6,8 +6,8 @@ import { Table as TableField } from "../fields/table.js";
|
|
|
6
6
|
import { Form } from "../form.js";
|
|
7
7
|
import { FormControl, FormControlContext } from "./form-control.js";
|
|
8
8
|
export type TableControlOptions<F extends Record<string, FormField>> = {
|
|
9
|
-
|
|
10
|
-
[field_name in keyof F]:
|
|
9
|
+
subfield_controls: {
|
|
10
|
+
[field_name in keyof F]: FormControl;
|
|
11
11
|
};
|
|
12
12
|
allow_removing?: boolean;
|
|
13
13
|
label_add?: string;
|
|
@@ -21,6 +21,7 @@ export type TableControlOptions<F extends Record<string, FormField>> = {
|
|
|
21
21
|
[field_name in keyof F]: unknown;
|
|
22
22
|
}>;
|
|
23
23
|
});
|
|
24
|
+
export declare const TABLE_COLUMN_FIELD_INDEX_PLACEHOLDER = "TABLE_ROW_INDEX________________";
|
|
24
25
|
export declare class Table<F extends Record<string, FormField>> extends FormControl {
|
|
25
26
|
table_field: TableField<F>;
|
|
26
27
|
options: TableControlOptions<F>;
|
|
@@ -30,4 +31,9 @@ export declare class Table<F extends Record<string, FormField>> extends FormCont
|
|
|
30
31
|
getFrameID(): string;
|
|
31
32
|
getActionURL(field_name: string, action: Record<string, unknown>): string;
|
|
32
33
|
mount(router: Router, form: Form<any, any>): void;
|
|
34
|
+
setAllowRemoving(value: boolean): this;
|
|
35
|
+
setAllowAdding(value: boolean): this;
|
|
36
|
+
setLabel(value: string): this;
|
|
37
|
+
setRemoveLabel(value: string): this;
|
|
38
|
+
setAddLabel(value: string): this;
|
|
33
39
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Router from "@koa/router";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
import { FlatTemplatable } from "tempstream";
|
|
4
|
+
import { FormField } from "../fields/field.js";
|
|
5
|
+
import { Table as TableField } from "../fields/table.js";
|
|
6
|
+
import { Form } from "../form.js";
|
|
7
|
+
import { FormControl, FormControlContext } from "./form-control.js";
|
|
8
|
+
export type TableControlOptions<F extends Record<string, FormField>> = {
|
|
9
|
+
render_fields: {
|
|
10
|
+
[field_name in keyof F]: (fctx: FormControlContext, name: string, value: string) => FlatTemplatable | Promise<FlatTemplatable>;
|
|
11
|
+
};
|
|
12
|
+
allow_removing?: boolean;
|
|
13
|
+
label_add?: string;
|
|
14
|
+
label: string;
|
|
15
|
+
label_remove?: string;
|
|
16
|
+
} & ({
|
|
17
|
+
allow_adding: false;
|
|
18
|
+
} | {
|
|
19
|
+
allow_adding: true;
|
|
20
|
+
make_new_row: (ctx: Context) => Promise<{
|
|
21
|
+
[field_name in keyof F]: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
});
|
|
24
|
+
export declare const TABLE_COLUMN_FIELD_INDEX_PLACEHOLDER = "____$$$$";
|
|
25
|
+
export declare class Table<F extends Record<string, FormField>> extends FormControl {
|
|
26
|
+
table_field: TableField<F>;
|
|
27
|
+
options: TableControlOptions<F>;
|
|
28
|
+
role: "input";
|
|
29
|
+
constructor(table_field: TableField<F>, options: TableControlOptions<F>);
|
|
30
|
+
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
31
|
+
getFrameID(): string;
|
|
32
|
+
getActionURL(field_name: string, action: Record<string, unknown>): string;
|
|
33
|
+
mount(router: Router, form: Form<any, any>): void;
|
|
34
|
+
setAllowRemoving(value: boolean): this;
|
|
35
|
+
setAllowAdding(value: boolean): this;
|
|
36
|
+
setLabel(value: string): this;
|
|
37
|
+
setRemoveLabel(value: string): this;
|
|
38
|
+
setAddLabel(value: string): this;
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { FormField } from "../fields/field.js";
|
|
3
|
+
import { FormDataValue } from "../form-types.js";
|
|
4
|
+
import { FormControlContext } from "./form-control.js";
|
|
5
|
+
import { SimpleInput, SimpleInputOptions } from "./simple-input.js";
|
|
6
|
+
export declare class Textarea extends SimpleInput<string | null> {
|
|
7
|
+
field: FormField<boolean, string | null>;
|
|
8
|
+
options: SimpleInputOptions & {
|
|
9
|
+
label?: string;
|
|
10
|
+
rows?: number;
|
|
11
|
+
cols?: number;
|
|
12
|
+
description?: string;
|
|
13
|
+
autogrow?: boolean;
|
|
14
|
+
};
|
|
15
|
+
constructor(field: FormField<boolean, string | null>, options?: SimpleInputOptions & {
|
|
16
|
+
label?: string;
|
|
17
|
+
rows?: number;
|
|
18
|
+
cols?: number;
|
|
19
|
+
description?: string;
|
|
20
|
+
autogrow?: boolean;
|
|
21
|
+
});
|
|
22
|
+
renderDescription(): string;
|
|
23
|
+
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
24
|
+
renderInput(ctx: Context, attributes: string, data: Record<string, FormDataValue>): Promise<string>;
|
|
25
|
+
}
|
|
@@ -3,8 +3,8 @@ import { FormField } from "../fields/field.js";
|
|
|
3
3
|
import { FormDataValue } from "../form-types.js";
|
|
4
4
|
import { FormControlContext } from "./form-control.js";
|
|
5
5
|
import { SimpleInput, SimpleInputOptions } from "./simple-input.js";
|
|
6
|
-
export declare class Textarea extends SimpleInput
|
|
7
|
-
field: FormField<boolean
|
|
6
|
+
export declare class Textarea extends SimpleInput {
|
|
7
|
+
field: FormField<boolean>;
|
|
8
8
|
options: SimpleInputOptions & {
|
|
9
9
|
label?: string;
|
|
10
10
|
rows?: number;
|
|
@@ -12,7 +12,7 @@ export declare class Textarea extends SimpleInput<string | null> {
|
|
|
12
12
|
description?: string;
|
|
13
13
|
autogrow?: boolean;
|
|
14
14
|
};
|
|
15
|
-
constructor(field: FormField<boolean
|
|
15
|
+
constructor(field: FormField<boolean>, options?: SimpleInputOptions & {
|
|
16
16
|
label?: string;
|
|
17
17
|
rows?: number;
|
|
18
18
|
cols?: number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { Checkbox } from "../controls/checkbox.js";
|
|
3
|
+
import { FormDataValue } from "../form-types.js";
|
|
4
|
+
import { FieldParseResult, FormField } from "./field.js";
|
|
5
|
+
import { FormControlContext } from "../controls/form-control.js";
|
|
6
|
+
export declare class Boolean<Required extends boolean> extends FormField<Required, boolean, Checkbox> {
|
|
7
|
+
error_message: string;
|
|
8
|
+
predicate: (v: unknown, w: unknown) => {
|
|
9
|
+
readonly match: boolean;
|
|
10
|
+
readonly wildcard: boolean;
|
|
11
|
+
};
|
|
12
|
+
constructor(required: Required, error_message?: string);
|
|
13
|
+
isValueValid(_: Context, value: boolean): Promise<{
|
|
14
|
+
valid: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<boolean>>;
|
|
18
|
+
getEmptyValue(): boolean;
|
|
19
|
+
getControl(): Checkbox;
|
|
20
|
+
getSealiousCreateValue(fctx: FormControlContext): Promise<boolean>;
|
|
21
|
+
sealiousValueToForm(_: Context, value: boolean | null): Promise<FormDataValue>;
|
|
22
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Context } from "koa";
|
|
2
|
+
import { Checkbox } from "../controls/checkbox.js";
|
|
2
3
|
import { FormDataValue } from "../form-types.js";
|
|
3
4
|
import { FieldParseResult, FormField } from "./field.js";
|
|
4
|
-
|
|
5
|
+
import { FormControlContext } from "../controls/form-control.js";
|
|
6
|
+
export declare class Boolean<Required extends boolean> extends FormField<Required, boolean, Checkbox> {
|
|
5
7
|
error_message: string;
|
|
6
8
|
predicate: (v: unknown, w: unknown) => {
|
|
7
9
|
readonly match: boolean;
|
|
@@ -14,4 +16,7 @@ export declare class Boolean<Required extends boolean> extends FormField<Require
|
|
|
14
16
|
}>;
|
|
15
17
|
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<boolean>>;
|
|
16
18
|
getEmptyValue(): boolean;
|
|
19
|
+
getControl(): Checkbox;
|
|
20
|
+
getSealiousCreateValue(fctx: FormControlContext): Promise<boolean>;
|
|
21
|
+
sealiousValueToForm(_: Context, value: boolean | null): Promise<FormDataValue>;
|
|
17
22
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { Checkbox } from "../controls/checkbox.js";
|
|
3
|
+
import { FormDataValue } from "../form-types.js";
|
|
4
|
+
import { FieldParseResult, FormField } from "./field.js";
|
|
5
|
+
import { FormControlContext } from "../controls/form-control.js";
|
|
6
|
+
export declare class Boolean<Required extends boolean> extends FormField<Required, boolean, Checkbox> {
|
|
7
|
+
error_message: string;
|
|
8
|
+
predicate: (v: unknown, w: unknown) => {
|
|
9
|
+
readonly match: boolean;
|
|
10
|
+
readonly wildcard: boolean;
|
|
11
|
+
};
|
|
12
|
+
constructor(required: Required, error_message?: string);
|
|
13
|
+
isValueValid(_: Context, value: boolean): Promise<{
|
|
14
|
+
valid: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<boolean>>;
|
|
18
|
+
getEmptyValue(): boolean;
|
|
19
|
+
getControl(): Checkbox;
|
|
20
|
+
getSealiousCreateValue(fctx: FormControlContext): Promise<boolean>;
|
|
21
|
+
sealiousValueToForm(_: Context, value: boolean | null): Promise<FormDataValue>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { CheckboxedListInput } from "../controls/checkboxed-list-input.js";
|
|
3
|
+
import { FormDataValue } from "../form-types.js";
|
|
4
|
+
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field.js";
|
|
5
|
+
export type CheckboxedListItem = {
|
|
6
|
+
value: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
group?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class CheckboxedListField<Required extends boolean, Values extends string> extends FormField<Required, Record<Values, "on">, CheckboxedListInput<Values>> {
|
|
11
|
+
required: Required;
|
|
12
|
+
generateOptions: (ctx: Context) => Promise<CheckboxedListItem[]>;
|
|
13
|
+
isVisible: (ctx: Context) => Promise<boolean>;
|
|
14
|
+
constructor(required: Required, generateOptions: (ctx: Context) => Promise<CheckboxedListItem[]>, isVisible?: (ctx: Context) => Promise<boolean>);
|
|
15
|
+
predicate: (v: unknown, w: unknown) => {
|
|
16
|
+
readonly match: boolean;
|
|
17
|
+
readonly wildcard: string[];
|
|
18
|
+
};
|
|
19
|
+
isValueValid(_: Context, value: unknown): Promise<FormFieldValidationResponse>;
|
|
20
|
+
parse(_: Context, raw_value: FormDataValue): Promise<FieldParseResult<Record<string, "on">>>;
|
|
21
|
+
getEmptyValue(): Record<string, "on">;
|
|
22
|
+
getControl(): CheckboxedListInput<Values>;
|
|
23
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Context } from "koa";
|
|
2
|
+
import { CheckboxedListInput } from "../controls/checkboxed-list-input.js";
|
|
2
3
|
import { FormDataValue } from "../form-types.js";
|
|
3
4
|
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field.js";
|
|
4
5
|
export type CheckboxedListItem = {
|
|
@@ -6,7 +7,7 @@ export type CheckboxedListItem = {
|
|
|
6
7
|
label?: string;
|
|
7
8
|
group?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare class CheckboxedListField<Required extends boolean> extends FormField<Required, Record<
|
|
10
|
+
export declare class CheckboxedListField<Required extends boolean, Values extends string> extends FormField<Required, Record<Values, "on">, CheckboxedListInput<Values>> {
|
|
10
11
|
required: Required;
|
|
11
12
|
generateOptions: (ctx: Context) => Promise<CheckboxedListItem[]>;
|
|
12
13
|
isVisible: (ctx: Context) => Promise<boolean>;
|
|
@@ -18,4 +19,5 @@ export declare class CheckboxedListField<Required extends boolean> extends FormF
|
|
|
18
19
|
isValueValid(_: Context, value: unknown): Promise<FormFieldValidationResponse>;
|
|
19
20
|
parse(_: Context, raw_value: FormDataValue): Promise<FieldParseResult<Record<string, "on">>>;
|
|
20
21
|
getEmptyValue(): Record<string, "on">;
|
|
22
|
+
getControl(): CheckboxedListInput<Values>;
|
|
21
23
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { ExtractFieldDecoded, Field } from "sealious";
|
|
3
|
+
import { SimpleInput } from "../controls/controls.js";
|
|
4
|
+
import { FormDataValue } from "../form-types.js";
|
|
5
|
+
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field.js";
|
|
6
|
+
import { ExtractedFieldInfo } from "../../utils/extract-fields-from-collection.js";
|
|
7
|
+
export declare class CollectionField<F extends Field<any>, Required extends boolean> extends FormField<Required, ExtractFieldDecoded<F> | null, SimpleInput<unknown>> {
|
|
8
|
+
sealiousField: F;
|
|
9
|
+
constructor(required: Required, sealiousField: F);
|
|
10
|
+
predicate: (v: unknown, w: unknown) => {
|
|
11
|
+
readonly match: true;
|
|
12
|
+
readonly wildcard: unknown;
|
|
13
|
+
};
|
|
14
|
+
parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<ExtractFieldDecoded<F> | null>>;
|
|
15
|
+
isValueValid(ctx: Context, value: ExtractFieldDecoded<F>): Promise<FormFieldValidationResponse>;
|
|
16
|
+
getEmptyValue(): ExtractFieldDecoded<F>;
|
|
17
|
+
getControl(): SimpleInput<unknown>;
|
|
18
|
+
generateFieldDeclaration(field_info: ExtractedFieldInfo, vars: {
|
|
19
|
+
form_field_types: string;
|
|
20
|
+
sealious_field: string;
|
|
21
|
+
}): string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { ExtractFieldDecoded, Field } from "sealious";
|
|
3
|
+
import { SimpleInput } from "../controls/controls.js";
|
|
4
|
+
import { FormDataValue } from "../form-types.js";
|
|
5
|
+
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field.js";
|
|
6
|
+
import { ExtractedFieldInfo } from "../../utils/extract-fields-from-collection.js";
|
|
7
|
+
export declare class CollectionField<F extends Field<any>, Required extends boolean> extends FormField<Required, ExtractFieldDecoded<F> | null, SimpleInput<unknown>> {
|
|
8
|
+
sealiousField: F;
|
|
9
|
+
constructor(required: Required, sealiousField: F);
|
|
10
|
+
predicate: (v: unknown, w: unknown) => {
|
|
11
|
+
readonly match: true;
|
|
12
|
+
readonly wildcard: unknown;
|
|
13
|
+
};
|
|
14
|
+
parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<ExtractFieldDecoded<F> | null>>;
|
|
15
|
+
isValueValid(ctx: Context, value: ExtractFieldDecoded<F>): Promise<FormFieldValidationResponse>;
|
|
16
|
+
getEmptyValue(): ExtractFieldDecoded<F>;
|
|
17
|
+
getControl(): SimpleInput<unknown>;
|
|
18
|
+
generateFieldDeclaration(field_info: ExtractedFieldInfo, vars: {
|
|
19
|
+
form_field_types: string;
|
|
20
|
+
sealious_field: string;
|
|
21
|
+
}): string;
|
|
22
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Context } from "koa";
|
|
2
2
|
import { ExtractFieldDecoded, Field } from "sealious";
|
|
3
|
+
import { SimpleInput } from "../controls/controls.js";
|
|
3
4
|
import { FormDataValue } from "../form-types.js";
|
|
4
5
|
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field.js";
|
|
5
|
-
|
|
6
|
+
import { ExtractedFieldInfo } from "../../utils/extract-fields-from-collection.js";
|
|
7
|
+
export declare class CollectionField<F extends Field<any>, Required extends boolean> extends FormField<Required, ExtractFieldDecoded<F> | null, SimpleInput> {
|
|
6
8
|
sealiousField: F;
|
|
7
9
|
constructor(required: Required, sealiousField: F);
|
|
8
10
|
predicate: (v: unknown, w: unknown) => {
|
|
@@ -12,4 +14,9 @@ export declare class CollectionField<F extends Field<any>, Required extends bool
|
|
|
12
14
|
parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<ExtractFieldDecoded<F> | null>>;
|
|
13
15
|
isValueValid(ctx: Context, value: ExtractFieldDecoded<F>): Promise<FormFieldValidationResponse>;
|
|
14
16
|
getEmptyValue(): ExtractFieldDecoded<F>;
|
|
17
|
+
getControl(): SimpleInput;
|
|
18
|
+
generateFieldDeclaration(field_info: ExtractedFieldInfo, vars: {
|
|
19
|
+
form_field_types: string;
|
|
20
|
+
sealious_field: string;
|
|
21
|
+
}): string;
|
|
15
22
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { FormControl, FormControlContext } from "../controls/form-control.js";
|
|
3
|
+
import { SimpleInput } from "../controls/simple-input.js";
|
|
4
|
+
import { FormDataValue } from "../form-types.js";
|
|
5
|
+
import { FieldParseResult } from "./field.js";
|
|
6
|
+
import { SimpleFormField } from "./simple-form-field.js";
|
|
7
|
+
export declare class Coordinates<Required extends boolean, DefaultControl extends FormControl = SimpleInput<[number, number] | null>> extends SimpleFormField<Required, DefaultControl, [number, number]> {
|
|
8
|
+
parse(_: Context, raw_value: FormDataValue): Promise<FieldParseResult<[number, number]>>;
|
|
9
|
+
getSealiousCreateValue(fctx: FormControlContext): Promise<[number, number] | undefined>;
|
|
10
|
+
postSealiousCreate(): Promise<void>;
|
|
11
|
+
postSealiousEdit(): Promise<void>;
|
|
12
|
+
getControl(): DefaultControl;
|
|
13
|
+
getEmptyValue(): [number, number];
|
|
14
|
+
}
|