extjsml 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/extjsmlc +70 -0
- data/lib/extclasses/actioncolumn.rb +11 -0
- data/lib/extclasses/booleancolumn.rb +34 -0
- data/lib/extclasses/button.rb +11 -0
- data/lib/extclasses/checkbox.rb +30 -0
- data/lib/extclasses/checkboxgroup.rb +14 -0
- data/lib/extclasses/checkcolumn.rb +16 -0
- data/lib/extclasses/combo.rb +56 -0
- data/lib/extclasses/compositefield.rb +11 -0
- data/lib/extclasses/container.rb +12 -0
- data/lib/extclasses/datecolumn.rb +21 -0
- data/lib/extclasses/datefield.rb +16 -0
- data/lib/extclasses/editorgrid.rb +97 -0
- data/lib/extclasses/fieldcontainer.rb +23 -0
- data/lib/extclasses/fieldset.rb +61 -0
- data/lib/extclasses/filefield.rb +18 -0
- data/lib/extclasses/form.rb +33 -0
- data/lib/extclasses/grid.rb +141 -0
- data/lib/extclasses/gridcolumn.rb +19 -0
- data/lib/extclasses/hidden.rb +7 -0
- data/lib/extclasses/htmleditor.rb +15 -0
- data/lib/extclasses/label.rb +10 -0
- data/lib/extclasses/numbercolumn.rb +30 -0
- data/lib/extclasses/numberfield.rb +19 -0
- data/lib/extclasses/paging.rb +12 -0
- data/lib/extclasses/panel.rb +29 -0
- data/lib/extclasses/passwordfield.rb +27 -0
- data/lib/extclasses/pivotgrid.rb +91 -0
- data/lib/extclasses/radio.rb +25 -0
- data/lib/extclasses/radiogroup.rb +14 -0
- data/lib/extclasses/runningcolumn.rb +9 -0
- data/lib/extclasses/tabpanel.rb +17 -0
- data/lib/extclasses/tbfill.rb +5 -0
- data/lib/extclasses/tbseparator.rb +5 -0
- data/lib/extclasses/templatecolumn.rb +11 -0
- data/lib/extclasses/textarea.rb +12 -0
- data/lib/extclasses/textfield.rb +27 -0
- data/lib/extclasses/timefield.rb +16 -0
- data/lib/extclasses/toolbar.rb +7 -0
- data/lib/extclasses/viewport.rb +8 -0
- data/lib/extclasses/window.rb +34 -0
- data/lib/extjsml/basenode.rb +347 -0
- data/lib/extjsml/ext_util.rb +232 -0
- data/lib/extjsml/generator.rb +578 -0
- data/lib/extjsml/parser.rb +35 -0
- data/lib/extmodules/form_field.rb +32 -0
- data/lib/extmodules/magic.rb +196 -0
- data/lib/extplugins/currency.rb +25 -0
- data/lib/extplugins/currencycolumn.rb +18 -0
- data/lib/extplugins/numeric.rb +32 -0
- data/lib/extplugins/pricefield.rb +36 -0
- data/lib/extuxs/uxaccount.rb +8 -0
- data/lib/extuxs/uxbroker.rb +7 -0
- data/lib/extuxs/uxchq.rb +8 -0
- data/lib/extuxs/uxreceiverinfo.rb +8 -0
- data/lib/extuxs/uxsettlement.rb +8 -0
- data/lib/test/test_parser.rb +97 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3b82f07f5506bdc027fac874eb16541450f4add0
|
4
|
+
data.tar.gz: edc2296c760b7a279afb938d96095b196b011b77
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d27fe6e45284898f507d7d9f19937d9bf524c6b52fd7df6d1a015ca470791179fb242a987f81db8e5dfe856c4c0662bf176c26d11cabc4b8d0b051e2092fe333
|
7
|
+
data.tar.gz: 99d606556da0c2d0ea51a69fd28afe1a5acebe86e0e843123a64067e86bac18ba7dd088166397df415f288d62bb51b23e0db0c67d34909866cac5a58f3c4547f
|
data/bin/extjsmlc
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'extjsml/generator'
|
4
|
+
|
5
|
+
def options_error
|
6
|
+
puts "extjsmlc: no input file ..."
|
7
|
+
end
|
8
|
+
|
9
|
+
commands = ARGV
|
10
|
+
f = ARGV[0]
|
11
|
+
with_requirejs = commands.any?{ |a| a == "-with-requirejs" }
|
12
|
+
gen_config = {}
|
13
|
+
jsclass = commands.grep(/\-\-class/)
|
14
|
+
|
15
|
+
if jsclass.count == 1
|
16
|
+
jsclass = jsclass.first.match(/\-\-class=(.*)/)[1]
|
17
|
+
else
|
18
|
+
jsclass = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
noid = commands.grep(/\-\-noid/).count > 0
|
22
|
+
|
23
|
+
if noid
|
24
|
+
gen_config.merge! :noid => true
|
25
|
+
end
|
26
|
+
|
27
|
+
if with_requirejs
|
28
|
+
gen_config.merge! :with_requirejs => true
|
29
|
+
end
|
30
|
+
|
31
|
+
if f.nil?
|
32
|
+
options_error
|
33
|
+
exit(1)
|
34
|
+
end
|
35
|
+
|
36
|
+
if f == "."
|
37
|
+
# "gen all yaml in dir"
|
38
|
+
files = Dir.open(".").grep(/yaml$/)
|
39
|
+
else
|
40
|
+
files = [f]
|
41
|
+
end
|
42
|
+
|
43
|
+
# loop generate by given files
|
44
|
+
files.each do |file|
|
45
|
+
dirname = File.dirname(File.absolute_path(file))
|
46
|
+
gen_config.merge!( :filedir => dirname )
|
47
|
+
|
48
|
+
js_class = file.split("/").last[0..-6] # strip .yaml
|
49
|
+
yaml_str = File.open(file,'rb')
|
50
|
+
|
51
|
+
js_class = jsclass unless jsclass.nil?
|
52
|
+
js_class = js_class.capitalize
|
53
|
+
|
54
|
+
contents = compile_jext(yaml_str, js_class, gen_config)
|
55
|
+
|
56
|
+
# create js ui file
|
57
|
+
File.open("#{dirname}/#{js_class}.ui.js","w") do |f|
|
58
|
+
f.write(contents[:ui_class_content])
|
59
|
+
end
|
60
|
+
puts "#{js_class}.ui.js created"
|
61
|
+
|
62
|
+
# gen js event script
|
63
|
+
unless File.exist?("#{dirname}/#{js_class}.js")
|
64
|
+
File.open("#{js_class}.js","w") do |f|
|
65
|
+
f.write(contents[:event_class_content])
|
66
|
+
end
|
67
|
+
puts "#{js_class}.js created"
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class ExtBooleancolumn < ExtNode
|
2
|
+
include Magic::Column
|
3
|
+
@@ALIAS_CONFIG = {
|
4
|
+
:text => :header,
|
5
|
+
:name => :dataIndex
|
6
|
+
}
|
7
|
+
|
8
|
+
def initialize(config, parent)
|
9
|
+
@default_config = {
|
10
|
+
trueText: "yes",
|
11
|
+
falseText: "no",
|
12
|
+
align: "center",
|
13
|
+
width: 45
|
14
|
+
}
|
15
|
+
|
16
|
+
if parent.xtype == "editorgrid"
|
17
|
+
super "checkcolumn", config, parent
|
18
|
+
else
|
19
|
+
super "booleancolumn", config, parent
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_extjs(at_deep = 0)
|
24
|
+
if parent.xtype == "editorgrid"
|
25
|
+
self.xtype = "checkcolumn"
|
26
|
+
else
|
27
|
+
self.xtype = "booleancolumn"
|
28
|
+
end
|
29
|
+
# if self.child_of? "editorgrid"
|
30
|
+
# @config.merge! :editor => { :xtype => "checkbox", :boxLabel => "Check" }
|
31
|
+
# end
|
32
|
+
super at_deep
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class ExtCheckbox < ExtNode
|
2
|
+
include FormField
|
3
|
+
|
4
|
+
@@ALIAS_CONFIG = {
|
5
|
+
:text => :boxLabel,
|
6
|
+
:ltext => :fieldLabel,
|
7
|
+
:rtext => :boxLabel,
|
8
|
+
:default => :checked
|
9
|
+
}
|
10
|
+
|
11
|
+
def initialize(config, parent)
|
12
|
+
@default_config = {
|
13
|
+
:fieldLabel => "<b></b>",
|
14
|
+
:labelAlign => "right",
|
15
|
+
:boxLabelAlign => "after",
|
16
|
+
:hideLabel => false,
|
17
|
+
:cls => "checkbox"
|
18
|
+
}
|
19
|
+
|
20
|
+
super "checkboxfield", config, parent
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_extjs(at_dept = 0)
|
24
|
+
if self.find_parent("checkboxgroup")
|
25
|
+
@config.merge! :hideLabel => true
|
26
|
+
end
|
27
|
+
|
28
|
+
super at_dept
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class ExtCheckcolumn < ExtNode
|
2
|
+
include Magic::Column
|
3
|
+
|
4
|
+
@@ALIAS_CONFIG = {
|
5
|
+
:text => :header,
|
6
|
+
:name => :dataIndex
|
7
|
+
}
|
8
|
+
|
9
|
+
def initialize(config, parent)
|
10
|
+
@default_config = {
|
11
|
+
:align => "right",
|
12
|
+
:sortable => true
|
13
|
+
}
|
14
|
+
super "checkcolumn", config, parent
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class ExtCombo < ExtNode
|
2
|
+
include FormField
|
3
|
+
include Magic::Store
|
4
|
+
include Magic::EmptyText
|
5
|
+
|
6
|
+
# TODO
|
7
|
+
@@XTYPE = "combo"
|
8
|
+
|
9
|
+
@@ALIAS_CONFIG = {
|
10
|
+
:text => :fieldLabel,
|
11
|
+
:display => :displayField,
|
12
|
+
:value => :valueField,
|
13
|
+
:min => :minChars,
|
14
|
+
:default => :value
|
15
|
+
}
|
16
|
+
|
17
|
+
# TODO
|
18
|
+
@@DEFAULT_CONFIG = {
|
19
|
+
|
20
|
+
}
|
21
|
+
|
22
|
+
def initialize(config, parent)
|
23
|
+
# TODO dummy store
|
24
|
+
@default_config = {
|
25
|
+
listConfig: {},
|
26
|
+
labelAlign: "right",
|
27
|
+
store: [],
|
28
|
+
minChars: 2,
|
29
|
+
valueField: "key",
|
30
|
+
displayField: "pair",
|
31
|
+
cls: "combo",
|
32
|
+
lazyInit: false,
|
33
|
+
mode: "local",
|
34
|
+
# editable: false,
|
35
|
+
triggerAction: "all",
|
36
|
+
loadingText: "Loading ..."
|
37
|
+
}
|
38
|
+
|
39
|
+
# listConfig flatten
|
40
|
+
[ :listWidth, :listMinWidth,
|
41
|
+
:listMaxWidth, :listResizable,
|
42
|
+
:listShadow, :listMaxHeight,
|
43
|
+
:listCls, :listEmpty,
|
44
|
+
:listLoadingText ].each do |k|
|
45
|
+
|
46
|
+
if config[k]
|
47
|
+
list_config_key = k.to_s.gsub(/list/, '')
|
48
|
+
list_config_key = list_config_key[0].downcase + list_config_key[1..-1]
|
49
|
+
@default_config[:listConfig][list_config_key] = config[k]
|
50
|
+
config.delete k
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
super "combo", config, parent
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class ExtDatecolumn < ExtNode
|
2
|
+
include Magic::Column
|
3
|
+
@@ALIAS_CONFIG = {
|
4
|
+
:text => :header,
|
5
|
+
:name => :dataIndex
|
6
|
+
}
|
7
|
+
def initialize(config, parent)
|
8
|
+
@default_config = {
|
9
|
+
format: "d/m/Y"
|
10
|
+
}
|
11
|
+
|
12
|
+
super "datecolumn", config, parent
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_extjs(at_deep = 0)
|
16
|
+
if self.child_of? "editorgrid"
|
17
|
+
@config.merge! :editor => { :xtype => "datefield", format: "d/m/Y" }
|
18
|
+
end
|
19
|
+
super at_deep
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class ExtDatefield < ExtNode
|
2
|
+
include FormField
|
3
|
+
|
4
|
+
@@ALIAS_CONFIG = {
|
5
|
+
:text => :fieldLabel
|
6
|
+
}
|
7
|
+
|
8
|
+
def initialize(config, parent)
|
9
|
+
@default_config = {
|
10
|
+
labelAlign: "right",
|
11
|
+
format: "d/m/Y",
|
12
|
+
cls: "date"
|
13
|
+
}
|
14
|
+
super "datefield", config, parent
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
class ExtEditorgrid < ExtNode
|
2
|
+
include Magic::Store
|
3
|
+
include Magic::Title
|
4
|
+
|
5
|
+
@@ALIAS_CONFIG = {
|
6
|
+
:text => :title
|
7
|
+
}
|
8
|
+
|
9
|
+
def initialize(config, parent)
|
10
|
+
@default_config = {
|
11
|
+
title: 'My Grid',
|
12
|
+
frame: true,
|
13
|
+
width: "auto",
|
14
|
+
height: 200,
|
15
|
+
clicksToEdit: 2,
|
16
|
+
# enableHdMenu: false,
|
17
|
+
enableColumnMove: false,
|
18
|
+
columnLines: true,
|
19
|
+
# TODO dummy store
|
20
|
+
store: [],
|
21
|
+
# style: "{ height: 100%; }",
|
22
|
+
viewConfig: {
|
23
|
+
forceFit: true
|
24
|
+
},
|
25
|
+
columns: [
|
26
|
+
{
|
27
|
+
xtype: 'gridcolumn',
|
28
|
+
dataIndex: 'string',
|
29
|
+
header: 'String',
|
30
|
+
sortable: true,
|
31
|
+
width: 100,
|
32
|
+
editor: {
|
33
|
+
xtype: 'textfield'
|
34
|
+
}
|
35
|
+
},
|
36
|
+
{
|
37
|
+
xtype: 'numbercolumn',
|
38
|
+
align: 'right',
|
39
|
+
dataIndex: 'number',
|
40
|
+
header: 'Number',
|
41
|
+
sortable: true,
|
42
|
+
width: 100,
|
43
|
+
editor: {
|
44
|
+
xtype: 'numberfield'
|
45
|
+
}
|
46
|
+
},
|
47
|
+
{
|
48
|
+
xtype: 'datecolumn',
|
49
|
+
dataIndex: 'date',
|
50
|
+
header: 'Date',
|
51
|
+
sortable: true,
|
52
|
+
width: 100,
|
53
|
+
editor: {
|
54
|
+
xtype: 'datefield'
|
55
|
+
}
|
56
|
+
},
|
57
|
+
{
|
58
|
+
xtype: 'booleancolumn',
|
59
|
+
dataIndex: 'bool',
|
60
|
+
header: 'Boolean',
|
61
|
+
sortable: true,
|
62
|
+
width: 100,
|
63
|
+
editor: {
|
64
|
+
xtype: 'checkbox',
|
65
|
+
boxLabel: 'BoxLabel'
|
66
|
+
}
|
67
|
+
}
|
68
|
+
]
|
69
|
+
}
|
70
|
+
|
71
|
+
super("editorgrid", config, parent)
|
72
|
+
end
|
73
|
+
|
74
|
+
def to_extjs(at_deep = 0)
|
75
|
+
# grid use child to another purpose, paging and toolbar columns
|
76
|
+
|
77
|
+
# columns
|
78
|
+
cols = []
|
79
|
+
self.childs.each do |c|
|
80
|
+
cols << c.to_extjs(at_deep) unless c.xtype.match(/column$/).nil?
|
81
|
+
end
|
82
|
+
@config.merge! :columns => cols unless cols.nil?
|
83
|
+
|
84
|
+
toolbar = self.find("toolbar")
|
85
|
+
@config.merge! :tbar => toolbar.to_extjs(at_deep + 1) if toolbar
|
86
|
+
|
87
|
+
paging = self.find("paging")
|
88
|
+
if paging
|
89
|
+
paging.override_config :store => @config[:store]
|
90
|
+
@config.merge! :bbar => paging.to_extjs(at_deep + 1)
|
91
|
+
end
|
92
|
+
|
93
|
+
# grid not allow to have items
|
94
|
+
self.childs = []
|
95
|
+
super(at_deep)
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class ExtFieldcontainer < ExtNode
|
2
|
+
include FormField
|
3
|
+
|
4
|
+
def initialize(config, parent)
|
5
|
+
@default_config = {
|
6
|
+
layout: 'hbox',
|
7
|
+
defaultType: 'textfield',
|
8
|
+
labelAlign: 'right'
|
9
|
+
}
|
10
|
+
|
11
|
+
super("fieldcontainer", config, parent)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_extjs(at_deep = 0)
|
15
|
+
|
16
|
+
# remove all childs' label
|
17
|
+
@childs.each do |c|
|
18
|
+
c.remove_config :fieldLabel
|
19
|
+
end
|
20
|
+
|
21
|
+
super at_deep
|
22
|
+
end
|
23
|
+
end
|