uki 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/frameworks/uki/README.rdoc +6 -15
- data/frameworks/uki/examples/core-examples/aristo/aristo.js +59 -0
- data/frameworks/uki/examples/core-examples/attachment/attachment.js +18 -0
- data/frameworks/uki/examples/core-examples/controls/controls.js +59 -0
- data/frameworks/uki/examples/core-examples/dnd/dnd.js +70 -0
- data/frameworks/uki/examples/core-examples/flow/flow.js +41 -0
- data/frameworks/uki/examples/core-examples/list/list.js +78 -0
- data/frameworks/uki/examples/core-examples/popup/popup.js +41 -0
- data/frameworks/uki/examples/core-examples/resizeToContents/resizeToContents.js +34 -0
- data/frameworks/uki/examples/core-examples/scrollPane/scrollPane.js +28 -0
- data/frameworks/uki/examples/core-examples/slider/slider.js +23 -0
- data/frameworks/uki/examples/core-examples/splitPane/splitPane.js +35 -0
- data/frameworks/uki/examples/core-examples/splitPaneExtended/splitPaneExtended.js +39 -0
- data/frameworks/uki/examples/core-examples/stress/stress.js +33 -0
- data/frameworks/uki/examples/core-examples/table/library.js +1 -0
- data/frameworks/uki/examples/core-examples/table/searchable.js +71 -0
- data/frameworks/uki/examples/core-examples/table/table.js +92 -0
- data/frameworks/uki/examples/core-examples/toolbar/icon.png +0 -0
- data/frameworks/uki/examples/core-examples/toolbar/toolbar.js +44 -0
- data/frameworks/uki/examples/core-examples/twitter/bubble.png +0 -0
- data/frameworks/uki/examples/core-examples/twitter/i/bubble-c.png +0 -0
- data/frameworks/uki/examples/core-examples/twitter/i/bubble-h.png +0 -0
- data/frameworks/uki/examples/core-examples/twitter/i/bubble-m.png +0 -0
- data/frameworks/uki/examples/core-examples/twitter/i/bubble-v.png +0 -0
- data/frameworks/uki/examples/core-examples/twitter/i/loading.gif +0 -0
- data/frameworks/uki/examples/core-examples/twitter/tweets.json +1 -0
- data/frameworks/uki/examples/core-examples/twitter/twitter.js +175 -0
- data/frameworks/uki/examples/core-examples/wave/contacts.json +1 -0
- data/frameworks/uki/examples/core-examples/wave/i/body/normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/body/normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/a-down-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/a-down-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/a-down-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/a-down.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/a-normal-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/a-normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/down-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/down-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/down-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/down.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/normal-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/normal-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down-m.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-down.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal-m.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-big-normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-down-m.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-down-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-down.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal-m.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/plus-normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/search-button-normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/search-button-normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-down-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-down.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/button/toolbar-button-normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons-c/drawer.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons-c/inbox.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons-c/pencil.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons-c/skeleton.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons-c/trash.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons-c/who.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/blue.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/dots.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/download.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/drawer.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/eye-closed.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/eye.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/folder.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/nosound.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/play.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/reply.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/skeleton.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/sprite-m.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/sprite-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/sprite.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/trash.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/icons/unknown.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/blue-c.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/blue-c.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/blue-h.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/blue-h.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/blue-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/blue-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/blue-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/blue.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/white-c.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/white-c.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/white-h.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/white-h.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/white-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/white-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/white-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/panel/white.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/popup/normal-c.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/popup/normal-c.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/popup/normal-h.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/popup/normal-h.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/popup/normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/popup/normal-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/popup/normal-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/popup/normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/searchField/focus-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/searchField/focus.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-v.gif +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/searchField/normal-v.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/searchField/normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/toolbar/normal-m.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/i/toolbar/normal.png +0 -0
- data/frameworks/uki/examples/core-examples/wave/voloko.jpg +0 -0
- data/frameworks/uki/examples/core-examples/wave/wave-theme.js +269 -0
- data/frameworks/uki/examples/core-examples/wave/wave.html +29 -0
- data/frameworks/uki/examples/core-examples/wave/wave.js +102 -0
- data/frameworks/uki/examples/core-examples/wave/waves.json +1 -0
- data/frameworks/uki/examples/css/examples.css +23 -0
- data/frameworks/uki/examples/css/index.css +0 -0
- data/frameworks/uki/examples/css/reset.css +43 -0
- data/frameworks/uki/examples/more-examples/radioButton/radioButton.js +17 -0
- data/frameworks/uki/examples/more-examples/splitTable/library.js +1 -0
- data/frameworks/uki/examples/more-examples/splitTable/searchable.js +71 -0
- data/frameworks/uki/examples/more-examples/splitTable/splitTable.js +98 -0
- data/frameworks/uki/examples/more-examples/toggleButton/toggleButton.js +14 -0
- data/frameworks/uki/examples/more-examples/treeList/i/arrows.png +0 -0
- data/frameworks/uki/examples/more-examples/treeList/treeList.js +35 -0
- data/frameworks/uki/examples/views/example.haml +8 -0
- data/frameworks/uki/examples/views/exampleList.haml +24 -0
- data/frameworks/uki/server.rb +84 -0
- data/frameworks/uki/spec/support/spec.helper.js +37 -1
- data/frameworks/uki/src/uki-core/background/cssBox.js +1 -1
- data/frameworks/uki/src/uki-core/builder.js +15 -10
- data/frameworks/uki/src/uki-core/dom/dnd.js +2 -1
- data/frameworks/uki/src/uki-core/uki.js +1 -1
- data/frameworks/uki/src/uki-core/utils.js +10 -3
- data/frameworks/uki/src/uki-core/view/base.js +2 -2
- data/frameworks/uki/src/uki-theme/airport.js +14 -0
- data/frameworks/uki/src/uki-view/view/button.js +4 -6
- data/frameworks/uki/src/uki-view/view/label.js +3 -3
- data/frameworks/uki/src/uki-view/view/list.js +26 -16
- data/frameworks/uki/src/uki-view/view/slider.js +3 -3
- data/frameworks/uki/src/uki-view/view/splitPane.js +1 -1
- data/frameworks/uki/src/uki-view/view/table.js +3 -3
- data/frameworks/uki/src/uki-view/view/table/column.js +1 -1
- data/frameworks/uki/src/uki-view/view/textField.js +18 -7
- data/uki.gemspec +139 -6
- metadata +140 -7
- data/frameworks/uki/compiler.jar +0 -0
- data/frameworks/uki/run.rb +0 -2
- data/frameworks/uki/thin.yaml +0 -11
- data/frameworks/uki/uki.rb +0 -38
- data/frameworks/uki/uki.ru +0 -2
@@ -0,0 +1,24 @@
|
|
1
|
+
!!!1.1
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{ "http-equiv" => "Content-type", "content" => "text/html; charset=utf-8" }
|
5
|
+
%title Uki examples
|
6
|
+
%link{ :rel => 'stylesheet', :href => '/examples/css/reset.css', :type => 'text/css', :media => 'screen' }
|
7
|
+
%link{ :rel => 'stylesheet', :href => '/examples/css/examples.css', :type => 'text/css', :media => 'screen' }
|
8
|
+
|
9
|
+
%body.text
|
10
|
+
%h1 <a href="/">Uki</a> code examples
|
11
|
+
%ul
|
12
|
+
- lastExample = nil
|
13
|
+
- exampleList.each do |example|
|
14
|
+
- if lastExample && example[:order] - lastExample[:order] > 100
|
15
|
+
%li
|
16
|
+
%br
|
17
|
+
- lastExample = example
|
18
|
+
%li
|
19
|
+
%a{:href => example[:path]}= example[:title]
|
20
|
+
%small
|
21
|
+
%a{:href => "http://github.com/voloko/ukijs.org/tree/master/examples/#{example[:path]}/"} source
|
22
|
+
- unless DEVELOPMENT
|
23
|
+
= File.read File.join(File.dirname(__FILE__), 'ga.txt')
|
24
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
SERVER_ROOT = File.expand_path(File.dirname(__FILE__))
|
2
|
+
DEVELOPMENT = ENV['RACK_ENV'] != 'production'
|
3
|
+
|
4
|
+
def get_example_page(path)
|
5
|
+
name = File.basename(path)
|
6
|
+
html_path = File.join(path, name + '.html')
|
7
|
+
if(File.exist?(html_path))
|
8
|
+
File.read(html_path)
|
9
|
+
else
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def list_examples(path)
|
15
|
+
result = []
|
16
|
+
Dir.new(path).each { |name|
|
17
|
+
if File.exist?(File.join(path, name, name + '.js'))
|
18
|
+
result << name
|
19
|
+
elsif !name.start_with?('.') && File.directory?(File.join(path, name))
|
20
|
+
result += list_examples(File.join(path, name)).map do |subname|
|
21
|
+
File.join(name, subname)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
}
|
25
|
+
result
|
26
|
+
end
|
27
|
+
|
28
|
+
def replace_src_paths(html, version_info)
|
29
|
+
version = version_info['version']
|
30
|
+
html.gsub(%r{src\s*=\s*["']/src/(.*?)\.cjs['"]}, "src='http://static.ukijs.org/pkg/#{version}/\\1.js'")
|
31
|
+
end
|
32
|
+
|
33
|
+
def extract_example_info path, &block
|
34
|
+
name = File.basename(path)
|
35
|
+
js_path = File.join(path, name + '.js')
|
36
|
+
js_contents = File.read(js_path)
|
37
|
+
yield js_contents
|
38
|
+
end
|
39
|
+
|
40
|
+
def extract_example_html(path)
|
41
|
+
extract_example_info(path) { |js_contents|
|
42
|
+
js_contents.match(%r{@example_html((.|[\n\r])*?)\*/})[1] rescue 'No html'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def extract_example_title(path)
|
47
|
+
extract_example_info(path) { |js_contents|
|
48
|
+
js_contents.match(%r{@example_title(.*?)(\*/|$)})[1] rescue 'Untitled'
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def extract_example_order(path)
|
53
|
+
extract_example_info(path) { |js_contents|
|
54
|
+
js_contents.match(%r{@example_order(.*?)(\*/|$)})[1].to_i rescue 9e6
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def encode64(str)
|
59
|
+
Base64.encode64(str).gsub("\n", '')
|
60
|
+
end
|
61
|
+
|
62
|
+
set :views, File.join(SERVER_ROOT, 'examples', 'views')
|
63
|
+
set :public, File.join(SERVER_ROOT, 'examples')
|
64
|
+
|
65
|
+
get '/' do
|
66
|
+
path = File.join(SERVER_ROOT, 'examples')
|
67
|
+
exampleList = list_examples(path).map do |name|
|
68
|
+
{
|
69
|
+
:path => name + '/',
|
70
|
+
:title => extract_example_title(File.join(path, name)),
|
71
|
+
:order => extract_example_order(File.join(path, name))
|
72
|
+
}
|
73
|
+
end.sort { |e1, e2| e1[:order] <=> e2[:order] }.select { |e| e[:order] > 0 }
|
74
|
+
haml :exampleList, :locals => { :exampleList => exampleList }
|
75
|
+
end
|
76
|
+
|
77
|
+
get '/:type/:example/' do
|
78
|
+
path = File.join(SERVER_ROOT, 'examples', params[:type], params[:example])
|
79
|
+
page = get_example_page(path)
|
80
|
+
page || haml(:example, :locals => {
|
81
|
+
:html => extract_example_html(path),
|
82
|
+
:title => extract_example_title(path)}
|
83
|
+
)
|
84
|
+
end
|
@@ -1 +1,37 @@
|
|
1
|
-
|
1
|
+
var triggerEvent,
|
2
|
+
mouseButtonsEvent;
|
3
|
+
if (document.createEventObject) {
|
4
|
+
triggerEvent = function(el, type, params) {
|
5
|
+
var event = uki.extend(
|
6
|
+
document.createEventObject(),
|
7
|
+
params
|
8
|
+
);
|
9
|
+
|
10
|
+
return el.fireEvent('on' + type, event);
|
11
|
+
};
|
12
|
+
} else {
|
13
|
+
triggerEvent = function(el, type, params) {
|
14
|
+
var event = document.createEvent('MouseEvents');
|
15
|
+
event.initMouseEvent(
|
16
|
+
type,
|
17
|
+
true,
|
18
|
+
true,
|
19
|
+
document.defaultView,
|
20
|
+
params.detail || 0,
|
21
|
+
params.screenX || 0,
|
22
|
+
params.screenY || 0,
|
23
|
+
params.clientX || 0,
|
24
|
+
params.clientY || 0,
|
25
|
+
params.ctrlKey || false,
|
26
|
+
params.altKey || false,
|
27
|
+
params.shiftKey || false,
|
28
|
+
params.metaKey || false,
|
29
|
+
params.button || 0,
|
30
|
+
null
|
31
|
+
);
|
32
|
+
uki.extend(event);
|
33
|
+
|
34
|
+
el.dispatchEvent(event);
|
35
|
+
};
|
36
|
+
}
|
37
|
+
|
@@ -37,7 +37,7 @@ uki.background.CssBox = uki.newClass(new function() {
|
|
37
37
|
this._container = uki.createElement(
|
38
38
|
'div',
|
39
39
|
options + ';position:absolute;overflow:hidden;z-index:' + (ext.zIndex || '-1') + ';' +
|
40
|
-
'left:' + inset.left + ';top:' + inset.top + 'px;right:' + inset.right + 'px;bottom:' + inset.bottom + 'px',
|
40
|
+
'left:' + inset.left + 'px;top:' + inset.top + 'px;right:' + inset.right + 'px;bottom:' + inset.bottom + 'px',
|
41
41
|
ext.innerHTML
|
42
42
|
);
|
43
43
|
this._attached = false;
|
@@ -23,7 +23,9 @@ include('collection.js');
|
|
23
23
|
if (ml.length === undefined) ml = [ml];
|
24
24
|
return new uki.Collection(createMulti(ml));
|
25
25
|
};
|
26
|
-
|
26
|
+
|
27
|
+
uki.viewNamespaces = ['uki.view.', ''];
|
28
|
+
|
27
29
|
function createMulti (ml) {
|
28
30
|
return uki.map(ml, function(mlRow) { return createSingle(mlRow); });
|
29
31
|
}
|
@@ -36,18 +38,21 @@ include('collection.js');
|
|
36
38
|
var c = mlRow.view || mlRow.type,
|
37
39
|
result;
|
38
40
|
if (uki.isFunction(c)) {
|
39
|
-
result = c();
|
41
|
+
result = new c(mlRow.rect);
|
40
42
|
} else if (typeof c === 'string') {
|
41
|
-
var
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
for (var i=0, ns = uki.viewNamespaces; i < ns.length; i++) {
|
44
|
+
var parts = (ns[i] + c).split('.'),
|
45
|
+
obj = root;
|
46
|
+
|
47
|
+
for (var j=0; obj && j < parts.length; j++) {
|
48
|
+
obj = obj[parts[j]];
|
49
|
+
};
|
50
|
+
if (obj) {
|
51
|
+
result = new obj(mlRow.rect);
|
52
|
+
break;
|
53
|
+
}
|
48
54
|
};
|
49
55
|
if (!obj) throw 'No view of type ' + c + ' found';
|
50
|
-
result = new obj(mlRow.rect);
|
51
56
|
} else {
|
52
57
|
result = c;
|
53
58
|
}
|
@@ -19,7 +19,8 @@ try {
|
|
19
19
|
typeof doc.createEvent('MouseEvent').dataTransfer == 'object' || // safari
|
20
20
|
doc.createEvent('DragEvent').initDragEvent // w3c support
|
21
21
|
) {
|
22
|
-
|
22
|
+
// Google Chrome has to many issues with native d&d. It is simpler to disable than to fix
|
23
|
+
dnd.nativeDnD = !ua.match(/Chrome\/4/);
|
23
24
|
}
|
24
25
|
} catch (e) {}
|
25
26
|
|
@@ -299,7 +299,7 @@ var utils = {
|
|
299
299
|
this.init.apply(this, arguments);
|
300
300
|
};
|
301
301
|
|
302
|
-
var inheritance, i, startFrom = 0, tmp, baseClasses = [];
|
302
|
+
var inheritance, i, startFrom = 0, tmp, baseClasses = [], base, name, copy;
|
303
303
|
|
304
304
|
if (arguments.length > 1) {
|
305
305
|
if (arguments[0].prototype) { // real inheritance
|
@@ -312,10 +312,17 @@ var utils = {
|
|
312
312
|
}
|
313
313
|
}
|
314
314
|
for (i=startFrom; i < arguments.length; i++) {
|
315
|
-
tmp = arguments[i];
|
315
|
+
base = tmp = arguments[i];
|
316
316
|
if (this.isFunction(tmp)) tmp = tmp.apply(tmp, baseClasses);
|
317
317
|
baseClasses.push(tmp);
|
318
|
-
|
318
|
+
|
319
|
+
for ( name in base ) {
|
320
|
+
copy = base[ name ];
|
321
|
+
if ( !base.hasOwnProperty(name) || copy === undefined ) continue;
|
322
|
+
klass.prototype[ name ] = copy;
|
323
|
+
}
|
324
|
+
|
325
|
+
// uki.extend(klass.prototype, base);
|
319
326
|
};
|
320
327
|
if (!klass.prototype.init) klass.prototype.init = function() {};
|
321
328
|
return klass;
|
@@ -18,8 +18,7 @@ uki.view.declare('uki.view.Base', uki.view.Observable, uki.view.Styleable, funct
|
|
18
18
|
|
19
19
|
var layoutId = 1;
|
20
20
|
|
21
|
-
this.defaultCss = 'position:absolute;z-index:100;-moz-user-focus:none;'
|
22
|
-
+ 'font-family:Arial,Helvetica,sans-serif;';
|
21
|
+
this.defaultCss = 'position:absolute;z-index:100;-moz-user-focus:none;';
|
23
22
|
|
24
23
|
/**
|
25
24
|
* Base class for all uki views.
|
@@ -79,6 +78,7 @@ uki.view.declare('uki.view.Base', uki.view.Observable, uki.view.Styleable, funct
|
|
79
78
|
_styleV: 'top',
|
80
79
|
_firstLayout: true
|
81
80
|
});
|
81
|
+
this.defaultCss += uki.theme.style('base');
|
82
82
|
};
|
83
83
|
|
84
84
|
/**
|
@@ -304,6 +304,20 @@
|
|
304
304
|
return handle;
|
305
305
|
|
306
306
|
}
|
307
|
+
},
|
308
|
+
styles: {
|
309
|
+
base: function() {
|
310
|
+
return 'font-family:Arial,Helvetica,sans-serif;';
|
311
|
+
},
|
312
|
+
'label': function() {
|
313
|
+
return 'font-size:12px;';
|
314
|
+
},
|
315
|
+
'button': function() {
|
316
|
+
return 'color:#333;text-align:center;font-weight:bold;';
|
317
|
+
},
|
318
|
+
'input': function() {
|
319
|
+
return 'font-size:11px;';
|
320
|
+
}
|
307
321
|
}
|
308
322
|
});
|
309
323
|
|
@@ -8,9 +8,9 @@ uki.view.declare('uki.view.Button', uki.view.Label, uki.view.Focusable, function
|
|
8
8
|
this._setup = function() {
|
9
9
|
Base._setup.call(this);
|
10
10
|
uki.extend(this, {
|
11
|
-
_inset: new Inset(0, 4)
|
12
|
-
defaultCss: Base.defaultCss + "cursor:default;-moz-user-select:none;-webkit-user-select:none;" //text-shadow:0 1px 0px rgba(255,255,255,0.8)
|
11
|
+
_inset: new Inset(0, 4)
|
13
12
|
});
|
13
|
+
this.defaultCss += "cursor:default;-moz-user-select:none;-webkit-user-select:none;" + uki.theme.style('button');
|
14
14
|
};
|
15
15
|
|
16
16
|
uki.addProps(this, ['backgroundPrefix']);
|
@@ -47,11 +47,9 @@ uki.view.declare('uki.view.Button', uki.view.Label, uki.view.Focusable, function
|
|
47
47
|
|
48
48
|
this._createDom = function() {
|
49
49
|
// dom
|
50
|
-
this._dom = uki.createElement('div', this.defaultCss
|
51
|
-
this._label = uki.createElement('div',
|
52
|
-
"font-size:12px;line-height:12px;white-space:nowrap;"); // text-shadow:0 1px 0px rgba(255,255,255,0.8);
|
50
|
+
this._dom = uki.createElement('div', this.defaultCss);
|
51
|
+
this._label = uki.createElement('div', this.defaultCss); // text-shadow:0 1px 0px rgba(255,255,255,0.8);
|
53
52
|
this._dom.appendChild(this._label);
|
54
|
-
this.style('fontWeight', 'bold');
|
55
53
|
|
56
54
|
this._dom.appendChild(uki.createElement('div', 'left:0;top:0;width:100%;height:100%;position:absolute;background:url(' + uki.theme.imageSrc('x') + ');'));
|
57
55
|
|
@@ -9,10 +9,11 @@ uki.view.declare('uki.view.Label', uki.view.Base, function(Base) {
|
|
9
9
|
_textSelectable: false,
|
10
10
|
_inset: new Inset()
|
11
11
|
});
|
12
|
+
this.defaultCss += uki.theme.style('label');
|
12
13
|
};
|
13
14
|
|
14
15
|
this._style = function(name, value) {
|
15
|
-
if (value !== undefined && 'font fontFamily fontWeight fontSize textDecoration color'.indexOf(name) != -1) {
|
16
|
+
if (value !== undefined && 'font fontFamily fontWeight fontSize textDecoration textOverflow textAlign overflow color'.indexOf(name) != -1) {
|
16
17
|
this._label.style[name] = value;
|
17
18
|
}
|
18
19
|
return Base._style.call(this, name, value);
|
@@ -85,8 +86,7 @@ uki.view.declare('uki.view.Label', uki.view.Base, function(Base) {
|
|
85
86
|
|
86
87
|
this._createDom = function() {
|
87
88
|
Base._createDom.call(this);
|
88
|
-
this._label = uki.createElement('div',
|
89
|
-
"font-size:12px;white-space:nowrap;"); // text-shadow:0 1px 0px rgba(255,255,255,0.8);
|
89
|
+
this._label = uki.createElement('div', this.defaultCss + 'white-space:nowrap;'); // text-shadow:0 1px 0px rgba(255,255,255,0.8);
|
90
90
|
this._dom.appendChild(this._label);
|
91
91
|
this.textSelectable(this.textSelectable());
|
92
92
|
};
|
@@ -58,22 +58,25 @@ uki.view.declare('uki.view.List', uki.view.Base, uki.view.Focusable, function(Ba
|
|
58
58
|
this.addRow = function(position, data) {
|
59
59
|
this._data.splice(position, 0, data);
|
60
60
|
var item = this._itemAt(position);
|
61
|
+
var container = doc.createElement('div');
|
62
|
+
|
63
|
+
container.innerHTML = this._rowTemplate.render({
|
64
|
+
height: this._rowHeight,
|
65
|
+
text: this._render.render(this._data[position], this._rowRect(position), position)
|
66
|
+
});
|
61
67
|
if (item) {
|
62
|
-
var container = doc.createElement('div');
|
63
|
-
|
64
|
-
container.innerHTML = this._rowTemplate.render({
|
65
|
-
height: this._rowHeight,
|
66
|
-
text: this._render.render(this._data[position], this._rowRect(position), position)
|
67
|
-
});
|
68
68
|
item.parentNode.insertBefore(container.firstChild, item);
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
} else {
|
70
|
+
this._dom.childNodes[0].appendChild(container.firstChild);
|
71
|
+
}
|
72
|
+
|
73
|
+
if (position <= this._packs[0].itemTo) {
|
74
|
+
this._packs[0].itemTo++;
|
75
|
+
this._packs[1].itemFrom++;
|
76
|
+
this._packs[1].itemTo++;
|
77
|
+
this._packs[1].dom.style.top = this._packs[1].itemFrom*this._rowHeight + 'px';
|
78
|
+
} else {
|
79
|
+
this._packs[1].itemTo++;
|
77
80
|
}
|
78
81
|
|
79
82
|
// offset selection
|
@@ -82,6 +85,10 @@ uki.view.declare('uki.view.List', uki.view.Base, uki.view.Focusable, function(Ba
|
|
82
85
|
this._selectedIndexes[i]++;
|
83
86
|
};
|
84
87
|
|
88
|
+
// needed for scrollbar
|
89
|
+
this.minSize(new Size(this.minSize().width, this._rowHeight * this._data.length));
|
90
|
+
this._relayoutParent();
|
91
|
+
|
85
92
|
return this;
|
86
93
|
};
|
87
94
|
|
@@ -106,16 +113,19 @@ uki.view.declare('uki.view.List', uki.view.Base, uki.view.Focusable, function(Ba
|
|
106
113
|
|
107
114
|
this.selectedIndexes = function(indexes) {
|
108
115
|
if (indexes === undefined) return this._selectedIndexes;
|
109
|
-
var changed = indexes != this._selectedIndexes;
|
110
116
|
this.clearSelection(true);
|
111
117
|
this._selectedIndexes = indexes;
|
112
118
|
for (var i=0; i < this._selectedIndexes.length; i++) {
|
113
119
|
this._setSelected(this._selectedIndexes[i], true);
|
114
120
|
};
|
115
|
-
|
121
|
+
this.trigger('selection', {source: this});
|
116
122
|
return this;
|
117
123
|
};
|
118
124
|
|
125
|
+
this.selectedRow = function() {
|
126
|
+
return this._data[this.selectedIndex()];
|
127
|
+
};
|
128
|
+
|
119
129
|
this.selectedRows = function() {
|
120
130
|
return uki.map(this.selectedIndexes(), function(index) {
|
121
131
|
return this._data[index];
|
@@ -47,11 +47,11 @@ uki.view.declare('uki.view.Slider', uki.view.Base, uki.view.Focusable, function(
|
|
47
47
|
};
|
48
48
|
|
49
49
|
this._createDom = function() {
|
50
|
-
this._dom = uki.createElement('div',
|
51
|
-
this._handle = uki.createElement('div',
|
50
|
+
this._dom = uki.createElement('div', this.defaultCss + 'height:18px;-moz-user-select:none;-webkit-user-select:none;overflow:visible;');
|
51
|
+
this._handle = uki.createElement('div', this.defaultCss + 'overflow:hidden;cursor:default;background:url(' + uki.theme.image('x').src + ')');
|
52
52
|
this._bg = uki.theme.image('slider-handle');
|
53
53
|
this._focusBg = uki.theme.image('slider-focus');
|
54
|
-
this._focusBg.style.cssText += this._bg.style.cssText +=
|
54
|
+
this._focusBg.style.cssText += this._bg.style.cssText += this.defaultCss + 'top:0;left:0;z-index:-1;position:absolute;';
|
55
55
|
this._handle.appendChild(this._bg);
|
56
56
|
|
57
57
|
|
@@ -73,7 +73,7 @@ uki.view.declare('uki.view.HSplitPane', uki.view.Container, function(Base) {
|
|
73
73
|
};
|
74
74
|
|
75
75
|
this._createDom = function() {
|
76
|
-
this._dom = uki.createElement('div',
|
76
|
+
this._dom = uki.createElement('div', this.defaultCss);
|
77
77
|
for (var i=0, paneML; i < 2; i++) {
|
78
78
|
paneML = { view: 'Container' };
|
79
79
|
paneML.anchors = i == 1 ? 'left top bottom right' :
|