@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hasShape, predicates } from "@sealcode/ts-predicates";
|
|
2
2
|
import qs from "qs";
|
|
3
3
|
import { tempstream } from "tempstream";
|
|
4
|
-
import {
|
|
4
|
+
import { TextBasedSimpleField } from "../fields/simple-form-field.js";
|
|
5
5
|
import { Derived } from "./derived.js";
|
|
6
6
|
import { FormFieldControl } from "./form-field-control.js";
|
|
7
7
|
function UnboundControl(controlClass, arbitrary_field_name, params) {
|
|
@@ -26,12 +26,12 @@ class StructuredArray extends FormFieldControl {
|
|
|
26
26
|
return {};
|
|
27
27
|
}
|
|
28
28
|
makeSubfield(_field_name) {
|
|
29
|
-
return new
|
|
29
|
+
return new TextBasedSimpleField(false);
|
|
30
30
|
}
|
|
31
31
|
async renderItemControl(ctx, form_id, control, item, index) {
|
|
32
32
|
const fctx = {
|
|
33
33
|
ctx,
|
|
34
|
-
data: {},
|
|
34
|
+
data: { raw_values: {}, messages: [], field_messages: {} },
|
|
35
35
|
messages: [],
|
|
36
36
|
field_name_prefix: "",
|
|
37
37
|
form_id,
|
|
@@ -46,9 +46,7 @@ class StructuredArray extends FormFieldControl {
|
|
|
46
46
|
);
|
|
47
47
|
return "";
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
`${this.field.name}[data][${index}][${field_name}]`
|
|
51
|
-
);
|
|
49
|
+
field.setName(`${this.field.name}[data][${index}][${field_name}]`);
|
|
52
50
|
const hidden_shadow = new Derived(
|
|
53
51
|
[field],
|
|
54
52
|
async (values, { inner_form_id, field_name: field_name2 }) => (
|
|
@@ -67,10 +65,22 @@ class StructuredArray extends FormFieldControl {
|
|
|
67
65
|
);
|
|
68
66
|
return tempstream`${new constructor(field, params).render({
|
|
69
67
|
...fctx,
|
|
70
|
-
data: {
|
|
68
|
+
data: {
|
|
69
|
+
raw_values: {
|
|
70
|
+
[field.name]: item[field_name]
|
|
71
|
+
},
|
|
72
|
+
messages: [],
|
|
73
|
+
field_messages: {}
|
|
74
|
+
}
|
|
71
75
|
})}${hidden_shadow.render({
|
|
72
76
|
...fctx,
|
|
73
|
-
data: {
|
|
77
|
+
data: {
|
|
78
|
+
raw_values: {
|
|
79
|
+
[field.name]: item[field_name]
|
|
80
|
+
},
|
|
81
|
+
messages: [],
|
|
82
|
+
field_messages: {}
|
|
83
|
+
},
|
|
74
84
|
form_id: this.getInnerFormID()
|
|
75
85
|
})}`;
|
|
76
86
|
} else {
|
|
@@ -93,7 +103,7 @@ class StructuredArray extends FormFieldControl {
|
|
|
93
103
|
</div>`;
|
|
94
104
|
}
|
|
95
105
|
async getItems(ctx, raw_values) {
|
|
96
|
-
return (await this.field.
|
|
106
|
+
return (await this.field.getParsedValue(ctx, raw_values)).parsed;
|
|
97
107
|
}
|
|
98
108
|
async _render(ctx, form_id, raw_values) {
|
|
99
109
|
const items = await this.getItems(ctx, raw_values);
|
|
@@ -114,13 +124,12 @@ class StructuredArray extends FormFieldControl {
|
|
|
114
124
|
</turbo-frame>`;
|
|
115
125
|
}
|
|
116
126
|
render(fctx) {
|
|
117
|
-
return this._render(fctx.ctx, fctx.form_id, fctx.data);
|
|
127
|
+
return this._render(fctx.ctx, fctx.form_id, fctx.data.raw_values);
|
|
118
128
|
}
|
|
119
129
|
async getTargetItemID(ctx) {
|
|
120
130
|
return ctx.params.id;
|
|
121
131
|
}
|
|
122
132
|
mount(router) {
|
|
123
|
-
console.log("mounting!", this.getActionURL());
|
|
124
133
|
router.post(this.getActionURL(), async (ctx) => {
|
|
125
134
|
const form_id = ctx.query.form_id;
|
|
126
135
|
if (typeof form_id != "string") {
|
|
@@ -134,7 +143,6 @@ class StructuredArray extends FormFieldControl {
|
|
|
134
143
|
throw new Error("Missing action param");
|
|
135
144
|
}
|
|
136
145
|
const field_data = ctx.$body[this.field.name] || { data: [] };
|
|
137
|
-
console.log({ action: field_data });
|
|
138
146
|
if (!hasShape(
|
|
139
147
|
{
|
|
140
148
|
data: predicates.array(
|
|
@@ -149,10 +157,6 @@ class StructuredArray extends FormFieldControl {
|
|
|
149
157
|
...ctx.$body.action,
|
|
150
158
|
data: field_data.data || []
|
|
151
159
|
});
|
|
152
|
-
console.log("ACTION", {
|
|
153
|
-
...ctx.$body.action,
|
|
154
|
-
data: field_data.data || []
|
|
155
|
-
});
|
|
156
160
|
await item.save(ctx.$context);
|
|
157
161
|
console.log(await item.getDecodedBody(ctx.$context, {}));
|
|
158
162
|
ctx.body = this._render(
|
|
@@ -7,9 +7,9 @@ class BigRadioGroup extends FormFieldControl {
|
|
|
7
7
|
this.options = options;
|
|
8
8
|
}
|
|
9
9
|
async render(fctx) {
|
|
10
|
-
const { raw: current_value } = await this.field.
|
|
10
|
+
const { raw: current_value } = await this.field.getParsedValue(
|
|
11
11
|
fctx.ctx,
|
|
12
|
-
fctx.data
|
|
12
|
+
fctx.data.raw_values
|
|
13
13
|
);
|
|
14
14
|
return tempstream`<div class="bigradios">
|
|
15
15
|
${Object.entries(this.options).map(([key, { description }]) => {
|
|
@@ -18,24 +18,24 @@ class CheckboxGroup extends FormFieldControl {
|
|
|
18
18
|
}).render(fctx);
|
|
19
19
|
}
|
|
20
20
|
async render(fctx) {
|
|
21
|
-
const { parsed: values } = await this.field.
|
|
21
|
+
const { parsed: values } = await this.field.getParsedValue(
|
|
22
22
|
fctx.ctx,
|
|
23
|
-
fctx.data
|
|
23
|
+
fctx.data.raw_values
|
|
24
24
|
);
|
|
25
|
-
const checkboxes = this.field.
|
|
25
|
+
const checkboxes = (await this.field.generateOptions(fctx.ctx)).map(
|
|
26
26
|
(option) => new CheckboxWithValue(
|
|
27
27
|
new ProxyFormField(
|
|
28
28
|
false,
|
|
29
29
|
this.field.name,
|
|
30
30
|
false,
|
|
31
|
-
(values ||
|
|
31
|
+
Object.keys(values || {}).includes(option.value)
|
|
32
32
|
),
|
|
33
33
|
{
|
|
34
|
-
id: this.field.name + "__" + option,
|
|
35
|
-
label: (this.options.checkboxNameToLabel || ((s) => s))(option),
|
|
34
|
+
id: this.field.name + "__" + option.value,
|
|
35
|
+
label: (this.options.checkboxNameToLabel || ((s) => s))(option.value),
|
|
36
36
|
default_value: false
|
|
37
37
|
},
|
|
38
|
-
option
|
|
38
|
+
option.value
|
|
39
39
|
)
|
|
40
40
|
);
|
|
41
41
|
return this.wrapGroup(fctx, checkboxes);
|
|
@@ -21,7 +21,11 @@ class CheckboxedListInput extends FormFieldControl {
|
|
|
21
21
|
valid,
|
|
22
22
|
message,
|
|
23
23
|
parsed: currentValue
|
|
24
|
-
} = await this.field.
|
|
24
|
+
} = await this.field.getParsedValue(
|
|
25
|
+
fctx.ctx,
|
|
26
|
+
fctx.data.raw_values,
|
|
27
|
+
true
|
|
28
|
+
);
|
|
25
29
|
const pickedValues = Object.entries(currentValue || {}).filter(([, is_on]) => is_on).map(([key]) => key);
|
|
26
30
|
const [options, isVisible] = await Promise.all([
|
|
27
31
|
this.field.generateOptions(fctx.ctx),
|
|
@@ -56,7 +60,9 @@ class CheckboxedListInput extends FormFieldControl {
|
|
|
56
60
|
([group_label, options2]) => tempstream` <h3>
|
|
57
61
|
${group_label}
|
|
58
62
|
</h3>
|
|
59
|
-
|
|
63
|
+
|
|
64
|
+
${// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
65
|
+
options2.map(
|
|
60
66
|
({ value, label }) => this.renderOption({
|
|
61
67
|
name,
|
|
62
68
|
value,
|
|
@@ -99,6 +105,7 @@ class CheckboxedListInput extends FormFieldControl {
|
|
|
99
105
|
name="${name}.${value}"
|
|
100
106
|
${checked ? "checked" : ""}
|
|
101
107
|
form=${form_id}
|
|
108
|
+
autocomplete="off"
|
|
102
109
|
/>
|
|
103
110
|
<label for="${name}.${value}">${label || value}</label>
|
|
104
111
|
`
|
|
@@ -23,10 +23,10 @@ export * from "./collapsible-field-group.js";
|
|
|
23
23
|
export * from "./collapsible-checkbox-group.js";
|
|
24
24
|
export * from "./autocomplete.js";
|
|
25
25
|
export * from "./file.js";
|
|
26
|
-
export * from "./
|
|
26
|
+
export * from "./image.js";
|
|
27
27
|
export * from "./multiple-files.js";
|
|
28
28
|
export * from "./number.js";
|
|
29
|
-
export * from "./multiple-
|
|
29
|
+
export * from "./multiple-images.js";
|
|
30
30
|
export * from "./array.js";
|
|
31
31
|
export * from "./table.js";
|
|
32
32
|
export {
|
|
@@ -12,7 +12,7 @@ class Derived extends FormControl {
|
|
|
12
12
|
async getBackendValues(fctx) {
|
|
13
13
|
const fieldnames = this.fields.map((f) => f.name);
|
|
14
14
|
const result = Object.fromEntries(
|
|
15
|
-
Object.entries(fctx.data).filter(
|
|
15
|
+
Object.entries(fctx.data.raw_values).filter(
|
|
16
16
|
([key]) => fieldnames.includes(key)
|
|
17
17
|
)
|
|
18
18
|
);
|
|
@@ -30,7 +30,10 @@ class FreeformDropdown extends SimpleInput {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
async renderInput(ctx, attributes_str, data) {
|
|
33
|
-
const { parsed: picked_value } = await this.field.
|
|
33
|
+
const { parsed: picked_value } = await this.field.getParsedValue(
|
|
34
|
+
ctx,
|
|
35
|
+
data
|
|
36
|
+
);
|
|
34
37
|
return (
|
|
35
38
|
/* HTML */
|
|
36
39
|
tempstream`<select ${attributes_str}>
|
|
@@ -11,9 +11,9 @@ class EditableCollectionSubset extends FormFieldControl {
|
|
|
11
11
|
this.role = "input";
|
|
12
12
|
}
|
|
13
13
|
async render(fctx) {
|
|
14
|
-
const { parsed: values } = await this.field.
|
|
14
|
+
const { parsed: values } = await this.field.getParsedValue(
|
|
15
15
|
fctx.ctx,
|
|
16
|
-
fctx.data
|
|
16
|
+
fctx.data.raw_values
|
|
17
17
|
);
|
|
18
18
|
return tempstream`<div>
|
|
19
19
|
<ul>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { PathFilePointer } from "@sealcode/file-manager";
|
|
1
2
|
import { tempstream } from "tempstream";
|
|
2
3
|
import { SimpleInput } from "./simple-input.js";
|
|
3
4
|
import { htmlEscape } from "escape-goat";
|
|
5
|
+
import { extname } from "node:path";
|
|
4
6
|
class File extends SimpleInput {
|
|
5
7
|
getType() {
|
|
6
8
|
return "file";
|
|
@@ -11,12 +13,31 @@ class File extends SimpleInput {
|
|
|
11
13
|
if (!file) {
|
|
12
14
|
return empty_container;
|
|
13
15
|
}
|
|
16
|
+
if (file instanceof PathFilePointer) {
|
|
17
|
+
const filename = await file.getOriginalFilename();
|
|
18
|
+
return tempstream`<div class="${class_name}">
|
|
19
|
+
<div class="${class_name}__icon">
|
|
20
|
+
<picture>
|
|
21
|
+
<img
|
|
22
|
+
src="/dist/sealgen/file-icon.svg"
|
|
23
|
+
width="80"
|
|
24
|
+
height="80"
|
|
25
|
+
alt=""
|
|
26
|
+
/>
|
|
27
|
+
<span class="${class_name}__icon__extension"
|
|
28
|
+
>${extname(filename)}</span
|
|
29
|
+
>
|
|
30
|
+
</picture>
|
|
31
|
+
<a href="${file.getURL()}" download>${filename}</a>
|
|
32
|
+
</div>
|
|
33
|
+
</div>`;
|
|
34
|
+
}
|
|
14
35
|
return tempstream`<div class="${class_name}">
|
|
15
36
|
${file.getOriginalFilename()}
|
|
16
37
|
</div>`;
|
|
17
38
|
}
|
|
18
39
|
async preInput(fctx, data) {
|
|
19
|
-
let { parsed } = await this.field.
|
|
40
|
+
let { parsed } = await this.field.getParsedValue(fctx.ctx, data);
|
|
20
41
|
if (parsed === null) {
|
|
21
42
|
parsed = { old: null, new: null };
|
|
22
43
|
}
|
|
@@ -35,7 +56,10 @@ class File extends SimpleInput {
|
|
|
35
56
|
}
|
|
36
57
|
async getInputAttributes(fctx) {
|
|
37
58
|
const original = await super.getInputAttributes(fctx);
|
|
38
|
-
const { parsed } = await this.field.
|
|
59
|
+
const { parsed } = await this.field.getParsedValue(
|
|
60
|
+
fctx.ctx,
|
|
61
|
+
fctx.data.raw_values
|
|
62
|
+
);
|
|
39
63
|
return {
|
|
40
64
|
...original,
|
|
41
65
|
name: this.field.name + "[new]",
|
|
@@ -20,11 +20,11 @@ describe("file-control", () => {
|
|
|
20
20
|
});
|
|
21
21
|
it("doesn't require image input if it already has old-value", async () => {
|
|
22
22
|
const port = await getPort();
|
|
23
|
-
console.log(`Using port ${port} for
|
|
23
|
+
console.log(`Using port ${port} for image.test.ts`);
|
|
24
24
|
const app = new Koa();
|
|
25
25
|
const router = new Router();
|
|
26
26
|
const fields = {
|
|
27
|
-
file: new Fields.File(true
|
|
27
|
+
file: new Fields.File(true)
|
|
28
28
|
};
|
|
29
29
|
let submit_called = false;
|
|
30
30
|
mount(
|
|
@@ -7,7 +7,10 @@ class HiddenInput extends FormFieldControl {
|
|
|
7
7
|
this.field = field;
|
|
8
8
|
}
|
|
9
9
|
async render(fctx) {
|
|
10
|
-
const { raw } = await this.field.
|
|
10
|
+
const { raw } = await this.field.getParsedValue(
|
|
11
|
+
fctx.ctx,
|
|
12
|
+
fctx.data.raw_values
|
|
13
|
+
);
|
|
11
14
|
return tempstream`<input type="hidden" name="${this.field.name}" value="${attribute((raw || "").toString())}" form="${fctx.form_id}">`;
|
|
12
15
|
}
|
|
13
16
|
}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { tempstream } from "tempstream";
|
|
2
2
|
import { File } from "./file.js";
|
|
3
|
-
class
|
|
4
|
-
constructor(field,
|
|
3
|
+
class Image extends File {
|
|
4
|
+
constructor(field, options) {
|
|
5
5
|
super(field, options);
|
|
6
6
|
this.field = field;
|
|
7
|
-
this.imageRouter = imageRouter;
|
|
8
7
|
}
|
|
9
8
|
async getImgStyle() {
|
|
10
9
|
return "width: 100px; height: 100px; object-fit: contain";
|
|
11
10
|
}
|
|
12
|
-
async renderFilePreview(
|
|
11
|
+
async renderFilePreview(ctx, file) {
|
|
13
12
|
const class_name = "file_preview";
|
|
14
13
|
const empty_container = `<div class="${class_name}"></div>`;
|
|
15
14
|
if (!file) {
|
|
16
15
|
return empty_container;
|
|
17
16
|
}
|
|
18
17
|
return tempstream`<div class="${class_name}">
|
|
19
|
-
${
|
|
18
|
+
${ctx.$app.imageRouter.image(await file.getPath(), {
|
|
20
19
|
resolutions: [100, 200],
|
|
21
20
|
sizesAttr: "100px",
|
|
22
21
|
crop: { width: 100, height: 100 },
|
|
@@ -54,6 +53,6 @@ class Photo extends File {
|
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
export {
|
|
57
|
-
|
|
56
|
+
Image
|
|
58
57
|
};
|
|
59
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -5,8 +5,7 @@ import { mount } from "../../mount.js";
|
|
|
5
5
|
import { Form } from "../form.js";
|
|
6
6
|
import { getBrowser } from "../../utils/browser-creator.js";
|
|
7
7
|
import { Fields } from "../../index.js";
|
|
8
|
-
import {
|
|
9
|
-
import { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
8
|
+
import { Image } from "./image.js";
|
|
10
9
|
import _locreq from "locreq";
|
|
11
10
|
import { module_dirname } from "../../utils/module-dirname.js";
|
|
12
11
|
import { FileManager, PathFilePointer } from "@sealcode/file-manager";
|
|
@@ -26,16 +25,9 @@ describe("photo-control", () => {
|
|
|
26
25
|
const app = new Koa();
|
|
27
26
|
const router = new Router();
|
|
28
27
|
const fields = {
|
|
29
|
-
photo: new Fields.File(false
|
|
28
|
+
photo: new Fields.File(false)
|
|
30
29
|
};
|
|
31
30
|
let received_photo;
|
|
32
|
-
const imageRouter = new KoaResponsiveImageRouter({
|
|
33
|
-
staticPath: "/images",
|
|
34
|
-
thumbnailSize: 20,
|
|
35
|
-
cacheManagerResolutionThreshold: 50,
|
|
36
|
-
imageStoragePath: `/tmp/image-cache-${port}`,
|
|
37
|
-
smartCropStoragePath: `/tmp/smartcrop-storage-${port}`
|
|
38
|
-
});
|
|
39
31
|
mount(
|
|
40
32
|
router,
|
|
41
33
|
"/",
|
|
@@ -43,7 +35,7 @@ describe("photo-control", () => {
|
|
|
43
35
|
constructor() {
|
|
44
36
|
super(...arguments);
|
|
45
37
|
this.fields = fields;
|
|
46
|
-
this.controls = [new
|
|
38
|
+
this.controls = [new Image(fields.photo)];
|
|
47
39
|
}
|
|
48
40
|
async onSubmit(ctx) {
|
|
49
41
|
const data = await this.getParsedValues(ctx);
|
|
@@ -80,16 +72,9 @@ describe("photo-control", () => {
|
|
|
80
72
|
const app = new Koa();
|
|
81
73
|
const router = new Router();
|
|
82
74
|
const fields = {
|
|
83
|
-
photo: new Fields.File(true
|
|
75
|
+
photo: new Fields.File(true)
|
|
84
76
|
};
|
|
85
77
|
let received_photo;
|
|
86
|
-
const imageRouter = new KoaResponsiveImageRouter({
|
|
87
|
-
staticPath: "/images",
|
|
88
|
-
thumbnailSize: 20,
|
|
89
|
-
cacheManagerResolutionThreshold: 50,
|
|
90
|
-
imageStoragePath: `/tmp/image-cache-${port}`,
|
|
91
|
-
smartCropStoragePath: `/tmp/smartcrop-storage-${port}`
|
|
92
|
-
});
|
|
93
78
|
let submit_called = false;
|
|
94
79
|
mount(
|
|
95
80
|
router,
|
|
@@ -98,7 +83,7 @@ describe("photo-control", () => {
|
|
|
98
83
|
constructor() {
|
|
99
84
|
super(...arguments);
|
|
100
85
|
this.fields = fields;
|
|
101
|
-
this.controls = [new
|
|
86
|
+
this.controls = [new Image(fields.photo)];
|
|
102
87
|
}
|
|
103
88
|
async onSubmit(ctx) {
|
|
104
89
|
submit_called = true;
|
|
@@ -132,4 +117,4 @@ describe("photo-control", () => {
|
|
|
132
117
|
});
|
|
133
118
|
}).timeout(1e4);
|
|
134
119
|
});
|
|
135
|
-
//# sourceMappingURL=
|
|
120
|
+
//# sourceMappingURL=image.test.js.map
|
|
@@ -107,7 +107,7 @@ class MultipleFiles extends FormFieldControl {
|
|
|
107
107
|
if (!token) {
|
|
108
108
|
return null;
|
|
109
109
|
}
|
|
110
|
-
return await item.collection.app.
|
|
110
|
+
return await item.collection.app.fileManager.fromToken(token);
|
|
111
111
|
}
|
|
112
112
|
async renderFileItemPreview(_fileItem, file) {
|
|
113
113
|
return file.getOriginalFilename();
|
|
@@ -186,6 +186,15 @@ class MultipleFiles extends FormFieldControl {
|
|
|
186
186
|
`
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
+
setLabel(label) {
|
|
190
|
+
this.options.label = label;
|
|
191
|
+
}
|
|
192
|
+
setUploadLabel(label) {
|
|
193
|
+
this.options.uploadLabel = label;
|
|
194
|
+
}
|
|
195
|
+
setAdditionalFieldsGetter(fn) {
|
|
196
|
+
this.options.getAdditionalFields = fn;
|
|
197
|
+
}
|
|
189
198
|
}
|
|
190
199
|
export {
|
|
191
200
|
MultipleFiles
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PathFilePointer } from "@sealcode/file-manager";
|
|
2
2
|
import { tempstream } from "tempstream";
|
|
3
3
|
import { MultipleFiles } from "./multiple-files.js";
|
|
4
|
-
class
|
|
4
|
+
class MultipleImages extends MultipleFiles {
|
|
5
5
|
constructor(field, imageRouter, options) {
|
|
6
6
|
super(field, options);
|
|
7
7
|
this.field = field;
|
|
@@ -37,6 +37,6 @@ class MultiplePhotos extends MultipleFiles {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
export {
|
|
40
|
-
|
|
40
|
+
MultipleImages
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=multiple-
|
|
42
|
+
//# sourceMappingURL=multiple-images.js.map
|
|
@@ -26,25 +26,23 @@ class SimpleInput extends FormFieldControl {
|
|
|
26
26
|
async getInputAttributes(fctx) {
|
|
27
27
|
const readonly = this.options.readonly || false;
|
|
28
28
|
const required = this.field.required;
|
|
29
|
-
const {
|
|
29
|
+
const { raw, valid } = await this.field.getParsedValue(
|
|
30
30
|
fctx.ctx,
|
|
31
|
-
fctx.data,
|
|
31
|
+
fctx.data.raw_values,
|
|
32
32
|
true
|
|
33
33
|
);
|
|
34
34
|
return Object.fromEntries([
|
|
35
35
|
["id", this.getID()],
|
|
36
36
|
["type", this.getType()],
|
|
37
37
|
["name", `${fctx.field_name_prefix}${this.field.name}`],
|
|
38
|
-
[
|
|
39
|
-
"value",
|
|
40
|
-
!valid && raw ? raw.toString() : parsed !== void 0 && parsed !== null ? parsed?.toString() || "" : ""
|
|
41
|
-
],
|
|
38
|
+
["value", raw],
|
|
42
39
|
...fctx.form_id ? [["form", fctx.form_id]] : [],
|
|
43
40
|
["placeholder", this.getPlaceholder()],
|
|
44
41
|
...readonly ? [["readonly", true]] : [],
|
|
45
42
|
...required ? [["required", true]] : [],
|
|
46
43
|
...!this.options.autocomplete ? [["autocomplete", "off"]] : [],
|
|
47
|
-
...this.options.step ? [["step", this.options.step]] : []
|
|
44
|
+
...this.options.step ? [["step", this.options.step]] : [],
|
|
45
|
+
["aria-invalid", String(!valid)]
|
|
48
46
|
]);
|
|
49
47
|
}
|
|
50
48
|
async postInput(_) {
|
|
@@ -67,9 +65,9 @@ class SimpleInput extends FormFieldControl {
|
|
|
67
65
|
async render(fctx) {
|
|
68
66
|
const id = this.getID();
|
|
69
67
|
const label = this.getLabel();
|
|
70
|
-
const { valid, message } = await this.field.
|
|
68
|
+
const { valid, message } = await this.field.getParsedValue(
|
|
71
69
|
fctx.ctx,
|
|
72
|
-
fctx.data,
|
|
70
|
+
fctx.data.raw_values,
|
|
73
71
|
true
|
|
74
72
|
);
|
|
75
73
|
return inputWrapper(
|
|
@@ -77,14 +75,17 @@ class SimpleInput extends FormFieldControl {
|
|
|
77
75
|
this.getWrapperModifiers(),
|
|
78
76
|
tempstream`
|
|
79
77
|
${label ? `<label for="${id}">${label}</label>` : ""}
|
|
80
|
-
${await this.preInput(fctx, fctx.data)}
|
|
78
|
+
${await this.preInput(fctx, fctx.data.raw_values)}
|
|
81
79
|
${this.renderInput(
|
|
82
80
|
fctx.ctx,
|
|
83
81
|
renderAttributes(await this.getInputAttributes(fctx)),
|
|
84
|
-
fctx.data
|
|
82
|
+
fctx.data.raw_values
|
|
85
83
|
)}
|
|
86
84
|
${this.postInput(fctx.ctx)}
|
|
87
|
-
${~valid && !this.options.hide_errors && fctx.validate ? `<div class="input__error">${
|
|
85
|
+
${~valid && !this.options.hide_errors && fctx.validate ? `<div class="input__error">${[
|
|
86
|
+
message,
|
|
87
|
+
fctx.data.field_messages?.[this.field.name]?.message
|
|
88
|
+
].filter((e) => !!e).join(" \xB7 ")}</div>` : ""}
|
|
88
89
|
`
|
|
89
90
|
);
|
|
90
91
|
}
|