glib-web 6.5.0 → 6.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2d8ea05929baccf426c3ef7f44c3b0c755ae8d27e67ce5ab4c654c3711eb0eb
4
- data.tar.gz: 4427906583b5ae24631feba633e286d1b702a51d9012b8a19e0c6409a2e31715
3
+ metadata.gz: c367b3b3e866dd9b73204e7d0cfe4b84e6148283b683c83068a52140c91ae987
4
+ data.tar.gz: a375dce696ed47b95d76e1f45091b004bb2c3aeafba70ebe0a31f0db37401d5a
5
5
  SHA512:
6
- metadata.gz: 3a734238edcb561b5a49479ee7cb01dc4ad147cac8beda29f2105719c1a2158dbbc5f886538a4adc68e6a1337d8c454efcba69d8e32ed2e9fe470b227c2ae780
7
- data.tar.gz: b819efbb6637bb5e622b79cc904c207e68686845f4f918cb5d840a0f465a66738d954a18661743b6dee2c5fa535047e9621bc7c82188fdbdd4d2a2765166ca3f
6
+ metadata.gz: 1dda92d5d21302e9b4064305b9732bcf39fed88a6e904873ba2d4ccb1cfb7dcfec00e88b3792a91574c26b37212d02fd0ce3a1d4e0a7efdd5556effa366d0ddf
7
+ data.tar.gz: b5abf3dccb58e18a81da0885fd6c7781da4906f9e329d767359c53a14352b20314506f42e6c2eb5742e483ef48a7cbaeebed43d4793d6de828cde8037080b474
@@ -3,5 +3,11 @@ class Glib::JsonUi::ViewBuilder
3
3
  class Video < View
4
4
  url :url
5
5
  end
6
+
7
+ class Docx < View
8
+ url :url
9
+ string :loadingText
10
+ string :errorText
11
+ end
6
12
  end
7
13
  end
@@ -547,6 +547,65 @@ class Glib::JsonUi::ViewBuilder
547
547
 
548
548
  end
549
549
 
550
+ # The Surfguard members-import table: a fork of bulkEdit2's builder for
551
+ # glib-web-npm's bulkEditSg component (same skeleton — form-peer
552
+ # submission, per-row POSTs, viewCells/viewHeaders — plus the Surfguard
553
+ # parse inputs). Deliberately SG-specific; consolidate with BulkEdit2 when
554
+ # a second consumer proves which props generalize.
555
+ class BulkEditSg < View
556
+ hash :import, required: [:submitUrl, :paramName]
557
+
558
+ # Override
559
+ def created
560
+ # Same form-peer rule as bulkEdit2 (see its comment).
561
+ if page.current_form
562
+ raise 'panels_bulkEditSg is not allowed inside a form; place it as a sibling and target it with forms_submit targetId'
563
+ end
564
+ end
565
+
566
+ # Maximum number of data rows an uploaded file may contain; files with
567
+ # more rows are rejected with an error dialog. No limit when unset.
568
+ int :maxRows
569
+
570
+ array :viewHeaders
571
+
572
+ # string :paramNameForFormData
573
+ string :paramNameForRowId
574
+ action :onCellChange
575
+ action :onRowsLoad
576
+ action :onRowsSelect
577
+ action :onRowsSucceed
578
+ # Fires when non-importable rows drain out of the table on save (they
579
+ # never POST), so the page can keep its Loaded/Uploaded/Skipped
580
+ # arithmetic honest.
581
+ action :onRowsSkip
582
+ action :onSubmitStart
583
+ action :onSubmitEnd
584
+
585
+ # Surfguard file shape: CSV header => form field. The parser follows
586
+ # this map, so a header-spelling fix is a one-line server change.
587
+ hash :headerMap
588
+ array :requiredHeaders
589
+ string :statusFilter
590
+
591
+ def viewCells(values)
592
+ json.set! 'viewCells' do
593
+ values.each do |value|
594
+ value.call(page.view_builder)
595
+ end
596
+ end
597
+ end
598
+
599
+ def dataRows(value)
600
+ json.dataRows value
601
+ end
602
+
603
+ def viewRows(value)
604
+ json.viewRows value
605
+ end
606
+
607
+ end
608
+
550
609
  # deprecated
551
610
  class BulkEdit < View
552
611
  hash :nextPage
@@ -73,6 +73,7 @@ nav_groups = {
73
73
  'calendar',
74
74
  'charts',
75
75
  'image',
76
+ 'multimedia_docx',
76
77
  'multimedia_video',
77
78
  'progressCircle',
78
79
  'switch'
@@ -0,0 +1,107 @@
1
+ json.title 'Test Page (Multimedia Docx)'
2
+
3
+ page = json_ui_page json
4
+
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
7
+ sample_url = "#{request.base_url}/sample.docx"
8
+ # A second URL lets the actions/events section verify the viewer re-renders
9
+ # when `url` changes without remounting.
10
+ alt_url = "#{request.base_url}/sample.docx?variant=alt"
11
+ missing_url = "#{request.base_url}/does-not-exist.docx"
12
+
13
+ page.body(
14
+ childViews: ->(body) do
15
+
16
+ body.panels_responsive(
17
+ padding: glib_json_padding_body,
18
+ childViews: ->(res) do
19
+ res.h2 text: 'Overview'
20
+ res.p text: 'Multimedia docx renders a .docx document client-side via docx-preview. ' \
21
+ 'NOTE: it fetches the raw file to the browser, so it is NOT a view-only guarantee.'
22
+ res.spacer height: 12
23
+ res.hr width: 'matchParent'
24
+ res.spacer height: 12
25
+
26
+ res.h2 text: 'Basic example'
27
+ res.spacer height: 8
28
+ res.multimedia_docx(
29
+ id: 'multimedia_docx_main',
30
+ width: 'matchParent',
31
+ url: sample_url
32
+ )
33
+
34
+ res.spacer height: 12
35
+ res.hr width: 'matchParent'
36
+ res.spacer height: 12
37
+
38
+ res.h2 text: 'Actions and events'
39
+ res.label text: 'Swap the source URL to confirm the viewer re-renders in place.'
40
+ res.spacer height: 8
41
+ res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
42
+ flow.button(
43
+ text: 'Sample',
44
+ onClick: ->(action) do
45
+ action.components_set(
46
+ targetId: 'multimedia_docx_main',
47
+ data: { url: sample_url }
48
+ )
49
+ end
50
+ )
51
+ flow.spacer width: 6
52
+ flow.button(
53
+ text: 'Reload same',
54
+ onClick: ->(action) do
55
+ action.components_set(
56
+ targetId: 'multimedia_docx_main',
57
+ data: { url: alt_url }
58
+ )
59
+ end
60
+ )
61
+ end
62
+
63
+ res.spacer height: 12
64
+ res.hr width: 'matchParent'
65
+ res.spacer height: 12
66
+
67
+ res.h2 text: 'Edge and advanced'
68
+ res.label text: 'A missing URL falls back to the error message.'
69
+ res.spacer height: 8
70
+ res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
71
+ flow.button(
72
+ text: 'No URL',
73
+ onClick: ->(action) do
74
+ action.components_set(
75
+ targetId: 'multimedia_docx_main',
76
+ data: { url: nil }
77
+ )
78
+ end
79
+ )
80
+ flow.spacer width: 6
81
+ flow.button(
82
+ text: 'Broken URL',
83
+ onClick: ->(action) do
84
+ action.components_set(
85
+ targetId: 'multimedia_docx_main',
86
+ data: { url: missing_url }
87
+ )
88
+ end
89
+ )
90
+ flow.spacer width: 6
91
+ flow.button(
92
+ text: 'Custom messages',
93
+ onClick: ->(action) do
94
+ action.components_set(
95
+ targetId: 'multimedia_docx_main',
96
+ data: {
97
+ url: missing_url,
98
+ errorText: 'This document could not be loaded.'
99
+ }
100
+ )
101
+ end
102
+ )
103
+ end
104
+ end
105
+ )
106
+ end
107
+ )
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.5.0
4
+ version: 6.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-08-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activestorage
@@ -471,6 +471,7 @@ files:
471
471
  - app/views/json_ui/garage/test_page/logics_run.json.jbuilder
472
472
  - app/views/json_ui/garage/test_page/logics_run_multi_form.json.jbuilder
473
473
  - app/views/json_ui/garage/test_page/logics_set.json.jbuilder
474
+ - app/views/json_ui/garage/test_page/multimedia_docx.json.jbuilder
474
475
  - app/views/json_ui/garage/test_page/multimedia_video.json.jbuilder
475
476
  - app/views/json_ui/garage/test_page/pagination.json.jbuilder
476
477
  - app/views/json_ui/garage/test_page/panels.json.jbuilder