glib-web 4.8.2 → 4.9.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: bd7cc62da4019492821f41a143535746725e97014c265ee5d887271bc8350f92
4
- data.tar.gz: 6cb94c5b31c3ee5a21f3bb7de0dadf622144a4986a68e82820103d9194145973
3
+ metadata.gz: 4bc560f6e7a39207eccdf57d1824992450c6ff9032cbb1598164c5a1fceac013
4
+ data.tar.gz: 33fc04d6d58545ed3951d942ed8d5002a772bc164442ba73bb4f27c409342fe1
5
5
  SHA512:
6
- metadata.gz: 404991efb9cc61da56f2c886beeeb5a4779e0731dc03dcd30d70d143568e2cc0934dd2a9999b566f71a3fe30f76e17e323b210735606c5627c28f4db8a7105b3
7
- data.tar.gz: b50e1fc04dab26be8c9bed1ac410cac570b556146fde3397987aaab6c09bd1283169cec978ebb317c2cd2517c223c7d3d81227e6e99e3508e80c15b471b1e695
6
+ metadata.gz: 5e78cc53ddcde671449504a62d1ccb33b746df252f1807d357a8665b764c4330de15a394eee3baf0e715b96eba81ad00a7dcc98c0e15d6da73d2e7e8e050ae05
7
+ data.tar.gz: c4352064bfb0d6d402f43b4d128c24e215406700bd79e5b63e584b30a3888b1e078271cffb7a886c4a08467bfc9790455a19f47ca0d12240e10f059cc2989549
@@ -326,36 +326,18 @@ class Glib::JsonUi::ViewBuilder
326
326
  end
327
327
  end
328
328
 
329
- class BulkEdit2 < View
329
+ class Table2 < View
330
330
  attr_reader :template
331
331
 
332
- hash :export, required: [:label, :fileName]
333
- hash :import, required: [:submitUrl, :paramName]
334
-
335
- action :onLoadRows
336
- action :onCellChange
337
-
338
- string :paramNameForFormData
339
-
340
- array :viewHeaders
341
- action :onRowSelected
332
+ hash :nextPage
333
+ action :onScrollToTop
334
+ action :onScrollToBottom
342
335
 
343
336
  def initialize(json, page)
344
337
  super
345
338
  @template = Glib::JsonUi::TableBuilders::Template.new(json, self)
346
339
  end
347
340
 
348
- # Experimental
349
- panels_builder :accessory, :header, :footer
350
-
351
- def viewCells(values)
352
- json.set! 'viewCells' do
353
- values.each do |value|
354
- value.call(page.view_builder)
355
- end
356
- end
357
- end
358
-
359
341
  def header(options = {})
360
342
  json.header do
361
343
  json.backgroundColor options.delete(:backgroundColor)
@@ -383,6 +365,29 @@ class Glib::JsonUi::ViewBuilder
383
365
 
384
366
  raise "Invalid properties: #{options.keys}" if options.size > 0
385
367
  end
368
+ end
369
+
370
+ class BulkEdit2 < View
371
+ hash :import, required: [:submitUrl, :paramName]
372
+
373
+ string :statusViewIdPrefix
374
+ array :viewHeaders
375
+
376
+ action :onLoadRows
377
+ action :onCellChange
378
+ string :paramNameForFormData
379
+ action :onRowSelected
380
+
381
+ # Experimental
382
+ panels_builder :accessory, :header, :footer
383
+
384
+ def viewCells(values)
385
+ json.set! 'viewCells' do
386
+ values.each do |value|
387
+ value.call(page.view_builder)
388
+ end
389
+ end
390
+ end
386
391
 
387
392
  def dataRows(value)
388
393
  json.dataRows value
@@ -559,6 +564,13 @@ class Glib::JsonUi::ViewBuilder
559
564
  # end
560
565
  end
561
566
 
567
+ class Pagination < View
568
+ int :length
569
+ int :value
570
+ action :onChange
571
+ string :paramNameForFieldName
572
+ end
573
+
562
574
  module ModelPanel
563
575
  attr_reader :model_name # See Panels::Form.field_name
564
576
  attr_reader :assoc_order_index
@@ -1,16 +1,15 @@
1
+ sleep 0.1
2
+ status_cell = params[:user]['statusCompId']
1
3
  json_ui_response json do |action|
2
- action.runMultiple childActions: ->(multiple) do
3
- # render "#{@path_prefix}/forms/alert_post_data", action: multiple
4
-
5
- status_cell = params[:user]['columns'][0]['compId']
6
-
7
- multiple.components_set \
8
- targetId: status_cell,
9
- data: {
10
- styleClasses: ['success'],
11
- material: {
12
- name: 'verified'
13
- }
4
+ action.components_set \
5
+ targetId: status_cell,
6
+ data: {
7
+ styleClasses: ['success'],
8
+ material: {
9
+ name: 'verified'
10
+ },
11
+ tooltip: {
12
+ text: 'Saved'
14
13
  }
15
- end
14
+ }
16
15
  end
@@ -45,7 +45,6 @@ page.scroll childViews: ->(scroll) do
45
45
  backgroundColor: '#e2e2e2',
46
46
  import: { submitUrl: json_ui_garage_url(path: 'forms/bulk_edit_post2'), paramName: 'user' },
47
47
  viewHeaders: [
48
- { text: '', id: 'status', minWidth: 24 },
49
48
  { text: 'Month', id: 'month', importable: true },
50
49
  { text: 'Electricity usage', id: 'electricity_usage', importable: true },
51
50
  { text: 'Gas usage', id: 'gas_usage', importable: true },
@@ -53,19 +52,16 @@ page.scroll childViews: ->(scroll) do
53
52
  ],
54
53
  viewCells: [
55
54
  ->(view) do
56
- view.icon name: params[:icon] || 'preview', styleClasses: ['warning'], tooltip: { text: params[:icon] || 'preview' }
55
+ view.fields_number width: 'matchParent'
57
56
  end,
58
57
  ->(view) do
59
- view.fields_number width: 100
58
+ view.fields_number width: 'matchParent'
60
59
  end,
61
60
  ->(view) do
62
- view.fields_number width: 150
61
+ view.fields_number width: 'matchParent'
63
62
  end,
64
63
  ->(view) do
65
- view.fields_number width: 100
66
- end,
67
- ->(view) do
68
- view.fields_select options: options
64
+ view.fields_select width: 'matchParent', options: options
69
65
  end
70
66
  ],
71
67
  paramNameForFormData: 'message',
@@ -3,34 +3,66 @@ json.title 'Tables'
3
3
  page = json_ui_page json
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.table styleClass: 'table--grid', sections: [
7
- ->(section) do
8
- section.header cellViews: ->(header) do
9
- header.label text: 'Vertical'
10
- header.label text: 'Horizontal'
11
- header.label text: 'Unordered List'
12
- end
13
-
14
- items = [1, 2, 3]
15
- section.rows objects: items, builder: ->(row, item, index) do
16
- row.default colStyles: [{ width: 200, backgroundColor: '#eeeeee' }], cellViews: ->(cell) do
17
- cell.panels_vertical childViews: ->(vertical) do
18
- vertical.h3 text: "Title #{item}"
19
- vertical.spacer height: 4
20
- vertical.label text: "Subtitle #{item}"
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
+ scroll.panels_form childViews: ->(form) do
8
+ form.panels_table styleClass: 'table--grid', sections: [
9
+ ->(section) do
10
+ section.header cellViews: ->(header) do
11
+ header.panels_horizontal childViews: ->(horizontal) do
12
+ horizontal.fields_check name: 'check_all', checkValue: 1, value: 0, onChange: ->(action) do
13
+ check_ids = (0..2).map { |i| "item_#{i}" }
14
+ action.logics_set targetIds: check_ids, conditionalData: {
15
+ value: { 'var': 'check_all' }
16
+ }
17
+ end
18
+ end
19
+ header.label text: 'Vertical'
20
+ header.label text: 'Horizontal'
21
+ header.label text: 'Unordered List'
21
22
  end
22
23
 
23
- cell.panels_horizontal childViews: ->(vertical) do
24
- vertical.label text: "Left #{item}"
25
- vertical.spacer width: 10
26
- vertical.label text: "Right #{item}"
27
- end
24
+ items = [1, 2, 3]
25
+ section.rows objects: items, builder: ->(row, item, index) do
26
+ row.default colStyles: [{ width: 200, backgroundColor: '#eeeeee' }], cellViews: ->(cell) do
27
+ cell.panels_horizontal childViews: ->(horizontal) do
28
+ horizontal.fields_check \
29
+ id: "item_#{index}",
30
+ name: 'user[items][]',
31
+ checkValue: index, # In the real-world, this is going to be the ID of a DB record.
32
+ onChange: ->(action) do
33
+ # TODO: Fix fields_check so it can support arrays
34
+ action.logics_set targetId: 'submit_button', conditionalData: {
35
+ text: {
36
+ 'printf': [
37
+ 'Submit {0} items',
38
+ { 'countNonNull': [{ 'var': 'user[items]' }] }
39
+ ]
40
+ }
41
+ }
42
+ end
43
+ end
44
+
45
+ cell.panels_vertical childViews: ->(vertical) do
46
+ vertical.h3 text: "Title #{item}"
47
+ vertical.spacer height: 4
48
+ vertical.label text: "Subtitle #{item}"
49
+ end
28
50
 
29
- cell.panels_ul childViews: ->(ul) do
30
- ul.label text: "Item A#{item}"
31
- ul.label text: "Item B#{item}"
51
+ cell.panels_horizontal childViews: ->(vertical) do
52
+ vertical.label text: "Left #{item}"
53
+ vertical.spacer width: 10
54
+ vertical.label text: "Right #{item}"
55
+ end
56
+
57
+ cell.panels_ul childViews: ->(ul) do
58
+ ul.label text: "Item A#{item}"
59
+ ul.label text: "Item B#{item}"
60
+ end
61
+ end
32
62
  end
33
63
  end
34
- end
64
+ ]
65
+
66
+ form.fields_submit id: 'submit_button', text: 'Submit'
35
67
  end
36
- ]
68
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.2
4
+ version: 4.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''