glib-web 6.10.0 → 6.10.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebde832f6f50b0556f57e6b2d716d7315fa01c0def0b75953f8ecf5de60ca547
4
- data.tar.gz: 4d217bd99f1a415bca302a08528a1da652788fc5cca031009e132079d2716381
3
+ metadata.gz: 50357c0c3002870707a68fad3a956248fb13cfb638395068ab970c0a7ee930ed
4
+ data.tar.gz: d04d1755a167f4d46c18aec66c958050c324192ee847b0ab0ed930ffd7ab2f7e
5
5
  SHA512:
6
- metadata.gz: bb08b62b519b2a2cfc7c9b1767fce93c4373b63b43082715211d44d051a58aafa5e94d4d5509fd907e86a2b0f6a4ce9c35ec7842ce29d2d21993cadcdf044796
7
- data.tar.gz: 715c3de7e58cfa4a443cc73b75b5c3d6a47bc5e9eff3eeb5cd812d119e0dff76e5c14832163abeb9ce891ea5c12b4922918b6133aa90a2848ff31fa49f40e664
6
+ metadata.gz: b72912d4e0dbe1fceb6d2180c292c390567a1c0d5ccc8e5f80bd20fa579d48b87cb0455a7ea3849469e24fbdb6ca90d5059e4c2799de0e0ab0dd15aa3c1e9430
7
+ data.tar.gz: fd855eb185f11b6d6e73becf6ab91ef1de85c78e957ae653e6f7a6e6bc9cb07eaa869f5f01142d8e73f674553dc621c4ebc517ce1b8bb4f76359a1571ca5bb60
@@ -659,7 +659,10 @@ class Glib::JsonUi::ViewBuilder
659
659
  class ChipGroup < AbstractField
660
660
  color :color
661
661
  array :options
662
- bool :multiple
662
+ # cache: true for the same reason as Upload's — without it a
663
+ # multiple-selection ChipGroup submits under a single key and only the
664
+ # last selected value survives server-side parsing.
665
+ bool :multiple, cache: true
663
666
  end
664
667
 
665
668
  class TimeZone < AbstractField
@@ -797,7 +800,11 @@ class Glib::JsonUi::ViewBuilder
797
800
  include Glib::JsonUi::FileUploadErrorHandler
798
801
 
799
802
  action :onFinishUpload
800
- bool :multiple
803
+ # cache: true so `@multiple` is set before AbstractField#created computes
804
+ # the submit key — without it the `[]` array suffix is dropped and a
805
+ # multi-file submit collapses to the last file server-side (silently
806
+ # saves one Document per drop instead of one per file).
807
+ bool :multiple, cache: true
801
808
  hash :placeholderView, required: [:type, :width, :height], optional: [:url]
802
809
  hash :inputView, optional: [:files, :variant]
803
810
  hash :clipboardView, optional: [:icon]
@@ -855,10 +862,67 @@ class Glib::JsonUi::ViewBuilder
855
862
  end
856
863
  end
857
864
 
865
+ # Signature field that lets the user draw a signature on a canvas and
866
+ # upload it as an image via ActiveStorage direct upload.
867
+ #
868
+ # The form shows a placeholder sized by `width`/`height`; tapping it opens
869
+ # a dialog with the drawing canvas, and Confirm uploads the drawing as a
870
+ # PNG to `directUploadUrl` and submits the resulting signed id under
871
+ # `name`. The placeholder then shows the signature, and reopening the
872
+ # dialog lets the user edit it. Because the canvas is not in the form,
873
+ # the placeholder can be given the same height as a neighbouring input
874
+ # (e.g. a typed-name alternative) without losing drawing space.
875
+ #
876
+ # `label` titles the dialog; `placeholder` replaces the "Tap to sign"
877
+ # prompt.
878
+ #
879
+ # With `typedName` the dialog gains Draw/Type tabs: the user can type
880
+ # their name instead of drawing, and the placeholder then shows the name
881
+ # in a handwriting style (the `glib-sign-typed` hook carries the font).
882
+ # The typed name is submitted under `typedName[:name]`; exactly one of the
883
+ # signed id and the typed name is ever non-blank. `typedName[:value]`
884
+ # pre-populates an existing name.
885
+ #
886
+ # @example Basic signature field
887
+ # form.fields_sign \
888
+ # name: 'user[signature]',
889
+ # label: 'Your signature',
890
+ # directUploadUrl: glib_direct_uploads_url,
891
+ # width: 320,
892
+ # height: 160,
893
+ # validation: { required: { message: 'add your signature!' } }
894
+ #
895
+ # @example Drawn or typed
896
+ # form.fields_sign \
897
+ # name: 'user[signature]',
898
+ # label: 'Your signature',
899
+ # typedName: { name: 'user[signature_name]', label: 'Type your full name', placeholder: 'Full name' },
900
+ # directUploadUrl: glib_direct_uploads_url,
901
+ # width: 320,
902
+ # height: 160
903
+ #
904
+ # @example Compact signature without validation
905
+ # form.fields_sign \
906
+ # id: 'signature_compact',
907
+ # name: 'user[signature_compact]',
908
+ # directUploadUrl: glib_direct_uploads_url,
909
+ # width: 220,
910
+ # height: 100
911
+ #
912
+ # @note The field deliberately has no pre-populated value: a saved
913
+ # signature is a signed id that cannot be redrawn from the canvas.
914
+ # Resize it via `components_set`/`logics_set` with `width`/`height`.
915
+ #
916
+ # @see app/views/json_ui/garage/test_page/fields_sign.json.jbuilder Garage examples
858
917
  class Sign < AbstractField
859
918
  string :directUploadUrl
860
919
  required :directUploadUrl
861
920
 
921
+ # Enables the Type tab. `name` is the param the typed name is submitted
922
+ # under; `value` pre-populates it; `label`/`placeholder` decorate the
923
+ # text input in the dialog.
924
+ hash :typedName, required: [:name], optional: [:value, :label, :placeholder]
925
+
862
926
  # Override
863
927
  # Signature field doesn't have default value
864
928
  def value(value)
@@ -25,6 +25,8 @@ page.body(
25
25
  form.fields_sign(
26
26
  id: 'signature_main',
27
27
  name: 'user[signature]',
28
+ label: 'Your signature',
29
+ typedName: { name: 'user[signature_name]', label: 'Type your full name', placeholder: 'Full name' },
28
30
  directUploadUrl: glib_direct_uploads_url,
29
31
  width: 320,
30
32
  height: 160,
@@ -113,7 +115,7 @@ page.body(
113
115
  text: 'Clear value',
114
116
  onClick: ->(action) do
115
117
  action.runMultiple childActions: ->(multiple) do
116
- multiple.components_set targetId: 'signature_main', data: { value: nil }
118
+ multiple.components_set targetId: 'signature_main', data: { value: '' }
117
119
  multiple.logics_set targetId: 'signature_status', data: { text: 'Status: cleared' }
118
120
  end
119
121
  end
@@ -137,7 +139,7 @@ page.body(
137
139
 
138
140
  form.h2 text: 'Edge/advanced'
139
141
  form.spacer height: 8
140
- form.label text: 'Use a small canvas to test tighter layouts.'
142
+ form.label text: 'A small, draw-only slot (no typedName, so the dialog has no tabs).'
141
143
  form.spacer height: 8
142
144
  form.fields_sign(
143
145
  id: 'signature_compact',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.10.0
4
+ version: 6.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-02 00:00:00.000000000 Z
11
+ date: 2026-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage