Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
6f547367
Commit
6f547367
authored
Feb 20, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
parents
4c0db9f7
2f15bc11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
9 deletions
+85
-9
combobox.js
src/ui/combobox.js
+75
-9
comboboxmenu.css
themes/default/_css/comboboxmenu.css
+10
-0
No files found.
src/ui/combobox.js
View file @
6f547367
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
"<%if(autoRecord) {%>"
+
"<%if(autoRecord) {%>"
+
"<%for( var i=0, len = recordStack.length; i<len; i++ ) {%>"
+
"<%for( var i=0, len = recordStack.length; i<len; i++ ) {%>"
+
"<%var index = recordStack[i];%>"
+
"<%var index = recordStack[i];%>"
+
"<li class=
\"
<%=itemClassName%><%if( selected == index ) {%> kmui-combobox-checked<%}%>
\"
data-item-index=
\"
<%=index%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
>"
+
"<li class=
\"
<%=itemClassName%><%if( selected == index ) {%> kmui-combobox-checked<%}%>
<%if( disabled[ index ] === true ) {%> kmui-combobox-item-disabled<%}%>
\"
data-item-index=
\"
<%=index%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
>"
+
"<span class=
\"
kmui-combobox-icon
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
></span>"
+
"<span class=
\"
kmui-combobox-icon
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
></span>"
+
"<label class=
\"
<%=labelClassName%>
\"
style=
\"
<%=itemStyles[ index ]%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
><%=items[index]%></label>"
+
"<label class=
\"
<%=labelClassName%>
\"
style=
\"
<%=itemStyles[ index ]%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
><%=items[index]%></label>"
+
"</li>"
+
"</li>"
+
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
"<%}%>"
+
"<%}%>"
+
"<%}%>"
+
"<%}%>"
+
"<%for( var i=0, label; label = items[i]; i++ ) {%>"
+
"<%for( var i=0, label; label = items[i]; i++ ) {%>"
+
"<li class=
\"
<%=itemClassName%><%if( selected == i ) {%> kmui-combobox-checked<%}%> kmui-combobox-item-<%=i%>
\"
data-item-index=
\"
<%=i%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
>"
+
"<li class=
\"
<%=itemClassName%><%if( selected == i ) {%> kmui-combobox-checked<%}%> kmui-combobox-item-<%=i%>
<%if( disabled[ i ] === true ) {%> kmui-combobox-item-disabled<%}%>
\"
data-item-index=
\"
<%=i%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
>"
+
"<span class=
\"
kmui-combobox-icon
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
></span>"
+
"<span class=
\"
kmui-combobox-icon
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
></span>"
+
"<label class=
\"
<%=labelClassName%>
\"
style=
\"
<%=itemStyles[ i ]%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
><%=label%></label>"
+
"<label class=
\"
<%=labelClassName%>
\"
style=
\"
<%=itemStyles[ i ]%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
><%=label%></label>"
+
"</li>"
+
"</li>"
+
...
@@ -46,6 +46,8 @@
...
@@ -46,6 +46,8 @@
value
:
[],
value
:
[],
comboboxName
:
''
,
comboboxName
:
''
,
selected
:
''
,
selected
:
''
,
//初始禁用状态
disabled
:
{},
//自动记录
//自动记录
autoRecord
:
true
,
autoRecord
:
true
,
//最多记录条数
//最多记录条数
...
@@ -126,11 +128,17 @@
...
@@ -126,11 +128,17 @@
*/
*/
select
:
function
(
index
){
select
:
function
(
index
){
var
itemCount
=
this
.
data
(
'options'
).
itemCount
,
var
options
=
this
.
data
(
'options'
),
items
=
this
.
data
(
'options'
).
autowidthitem
;
itemCount
=
options
.
itemCount
,
items
=
options
.
autowidthitem
;
if
(
items
&&
!
items
.
length
)
{
if
(
items
&&
!
items
.
length
)
{
items
=
this
.
data
(
'options'
).
items
;
items
=
options
.
items
;
}
// 禁用
if
(
options
.
disabled
[
index
]
)
{
return
null
;
}
}
if
(
itemCount
==
0
)
{
if
(
itemCount
==
0
)
{
...
@@ -178,6 +186,58 @@
...
@@ -178,6 +186,58 @@
}
);
}
);
},
},
getItems
:
function
()
{
return
this
.
data
(
"options"
).
items
;
},
getItemMapping
:
function
()
{
return
this
.
data
(
"options"
).
itemMapping
;
},
disableItemByIndex
:
function
(
index
)
{
var
options
=
this
.
data
(
"options"
);
options
.
disabled
[
index
]
=
true
;
this
.
_repaint
();
},
disableItemByLabel
:
function
(
label
)
{
var
itemMapping
=
this
.
data
(
'options'
).
itemMapping
,
index
=
itemMapping
[
label
];
if
(
typeof
index
===
"number"
)
{
return
this
.
disableItemByIndex
(
index
);
}
return
false
;
},
enableItemByIndex
:
function
(
index
)
{
var
options
=
this
.
data
(
"options"
);
delete
options
.
disabled
[
index
];
this
.
_repaint
();
},
enableItemByLabel
:
function
(
label
)
{
var
itemMapping
=
this
.
data
(
'options'
).
itemMapping
,
index
=
itemMapping
[
label
];
if
(
typeof
index
===
"number"
)
{
return
this
.
enableItemByIndex
(
index
);
}
return
false
;
},
/**
/**
* 转换记录栈
* 转换记录栈
*/
*/
...
@@ -256,8 +316,7 @@
...
@@ -256,8 +316,7 @@
_update
:
function
(
index
)
{
_update
:
function
(
index
)
{
var
options
=
this
.
data
(
"options"
),
var
options
=
this
.
data
(
"options"
),
newStack
=
[],
newStack
=
[];
newChilds
=
null
;
$
.
each
(
options
.
recordStack
,
function
(
i
,
item
){
$
.
each
(
options
.
recordStack
,
function
(
i
,
item
){
...
@@ -277,13 +336,20 @@
...
@@ -277,13 +336,20 @@
options
.
recordStack
=
newStack
;
options
.
recordStack
=
newStack
;
options
.
selected
=
index
;
options
.
selected
=
index
;
newChilds
=
$
(
$
.
parseTmpl
(
this
.
tpl
,
options
)
);
this
.
_repaint
();
newStack
=
null
;
},
_repaint
:
function
()
{
var
newChilds
=
$
(
$
.
parseTmpl
(
this
.
tpl
,
this
.
data
(
"options"
)
)
);
//重新渲染
//重新渲染
this
.
root
().
html
(
newChilds
.
html
()
);
this
.
root
().
html
(
newChilds
.
html
()
);
newChilds
=
null
;
newChilds
=
null
;
newStack
=
null
;
}
}
};
};
...
...
themes/default/_css/comboboxmenu.css
View file @
6f547367
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
.kmui-combobox-menu
.kmui-combobox-item
{
.kmui-combobox-menu
.kmui-combobox-item
{
display
:
block
;
display
:
block
;
border
:
1px
solid
white
;
border
:
1px
solid
white
;
white-space
:
nowrap
;
}
}
.kmui-combobox-menu
.kmui-combobox-item-label
{
.kmui-combobox-menu
.kmui-combobox-item-label
{
...
@@ -184,4 +185,13 @@
...
@@ -184,4 +185,13 @@
/* h6 */
/* h6 */
.kmui-combobox-paragraph
.kmui-combobox-item-6
.kmui-combobox-item-label
{
.kmui-combobox-paragraph
.kmui-combobox-item-6
.kmui-combobox-item-label
{
font-size
:
12px
;
font-size
:
12px
;
}
.kmui-combobox-menu
.kmui-combobox-item-disabled
{
opacity
:
0.3
;
}
.kmui-combobox-menu
.kmui-combobox-item-disabled
:HOVER
{
border-color
:
#fff
;
background-color
:
#fff
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment