Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
leizi929
Sortable
提交
c3d724d8
S
Sortable
项目概览
leizi929
/
Sortable
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Sortable
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c3d724d8
编写于
11月 14, 2015
作者:
S
Sebastian Rosengren
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Knockout - Fixes #623 #585 #557
上级
4b9fc79d
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
16 deletion
+22
-16
README.md
README.md
+2
-2
Sortable.js
Sortable.js
+1
-1
Sortable.min.js
Sortable.min.js
+2
-2
component.json
component.json
+1
-1
knockout-sortable.js
knockout-sortable.js
+7
-6
knockout/example.html
knockout/example.html
+9
-4
未找到文件。
README.md
浏览文件 @
c3d724d8
...
@@ -655,11 +655,11 @@ Link to the active instance.
...
@@ -655,11 +655,11 @@ Link to the active instance.
```
html
```
html
<!-- CDNJS :: Sortable (https://cdnjs.com/) -->
<!-- CDNJS :: Sortable (https://cdnjs.com/) -->
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.
0
-rc1/Sortable.min.js"
></script>
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.
2
-rc1/Sortable.min.js"
></script>
<!-- jsDelivr :: Sortable (http://www.jsdelivr.com/) -->
<!-- jsDelivr :: Sortable (http://www.jsdelivr.com/) -->
<script
src=
"//cdn.jsdelivr.net/sortable/1.4.
0
-rc1/Sortable.min.js"
></script>
<script
src=
"//cdn.jsdelivr.net/sortable/1.4.
2
-rc1/Sortable.min.js"
></script>
<!-- jsDelivr :: Sortable :: Latest (http://www.jsdelivr.com/) -->
<!-- jsDelivr :: Sortable :: Latest (http://www.jsdelivr.com/) -->
...
...
Sortable.js
浏览文件 @
c3d724d8
...
@@ -1258,6 +1258,6 @@
...
@@ -1258,6 +1258,6 @@
// Export
// Export
Sortable
.
version
=
'
1.4.
0
'
;
Sortable
.
version
=
'
1.4.
2
'
;
return
Sortable
;
return
Sortable
;
});
});
Sortable.min.js
浏览文件 @
c3d724d8
此差异已折叠。
点击以展开。
component.json
浏览文件 @
c3d724d8
{
{
"name"
:
"Sortable"
,
"name"
:
"Sortable"
,
"main"
:
"Sortable.js"
,
"main"
:
"Sortable.js"
,
"version"
:
"1.4.
0
"
,
"version"
:
"1.4.
2
"
,
"homepage"
:
"http://rubaxa.github.io/Sortable/"
,
"homepage"
:
"http://rubaxa.github.io/Sortable/"
,
"repo"
:
"RubaXa/Sortable"
,
"repo"
:
"RubaXa/Sortable"
,
"authors"
:
[
"authors"
:
[
...
...
knockout-sortable.js
浏览文件 @
c3d724d8
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
moveItem
(
itemVM
,
removeOperation
.
collection
,
addOperation
.
collection
,
addOperation
.
event
.
clone
,
addOperation
.
event
);
moveItem
(
itemVM
,
removeOperation
.
collection
,
addOperation
.
collection
,
addOperation
.
event
.
clone
,
addOperation
.
event
);
}
}
},
},
// Moves an item from the "
to" collection to the "from
" collection, these
// Moves an item from the "
from" collection to the "to
" collection, these
// can be references to the same collection which means it's a sort.
// can be references to the same collection which means it's a sort.
// clone indicates if we should move or copy the item into the new collection
// clone indicates if we should move or copy the item into the new collection
moveItem
=
function
(
itemVM
,
from
,
to
,
clone
,
e
)
{
moveItem
=
function
(
itemVM
,
from
,
to
,
clone
,
e
)
{
...
@@ -89,11 +89,12 @@
...
@@ -89,11 +89,12 @@
originalIndex
=
fromArray
.
indexOf
(
itemVM
),
originalIndex
=
fromArray
.
indexOf
(
itemVM
),
newIndex
=
e
.
newIndex
;
newIndex
=
e
.
newIndex
;
if
(
e
.
item
.
previousElementSibling
)
// We have to find out the actual desired index of the to array,
{
// as this might be a computed array. We could otherwise potentially
newIndex
=
fromArray
.
indexOf
(
ko
.
dataFor
(
e
.
item
.
previousElementSibling
));
// drop an item above the 3rd visible item, but the 2nd visible item
if
(
originalIndex
>
newIndex
)
// has an actual index of 5.
newIndex
=
newIndex
+
1
;
if
(
e
.
item
.
previousElementSibling
)
{
newIndex
=
to
().
indexOf
(
ko
.
dataFor
(
e
.
item
.
previousElementSibling
))
+
1
;
}
}
// Remove sortables "unbound" element
// Remove sortables "unbound" element
...
...
knockout/example.html
浏览文件 @
c3d724d8
...
@@ -51,8 +51,8 @@
...
@@ -51,8 +51,8 @@
</ul>
</ul>
</div>
</div>
<div
class=
"col-1_2 mirror"
>
<div
class=
"col-1_2 mirror"
>
<h4>
Sortable
computed mirror
ed
</h4>
<h4>
Sortable
underlaying comput
ed
</h4>
<ul
data-bind=
"foreach:
s
ortableComputedItems"
>
<ul
data-bind=
"foreach:
underlayingS
ortableComputedItems"
>
<li
data-bind=
"text: name"
></li>
<li
data-bind=
"text: name"
></li>
</ul>
</ul>
</div>
</div>
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
<script
src=
"../knockout-sortable.js"
></script>
<script
src=
"../knockout-sortable.js"
></script>
<script>
<script>
var
sortableComputedItems
=
[{
name
:
'
Sortable computed 1
'
},
{
name
:
'
Sortable computed 2
'
},
{
name
:
'
Sortable computed 3
'
}];
var
sortableComputedItems
=
[{
name
:
'
Sortable computed 1
'
},
{
name
:
'
Filtered computed 2
'
},
{
name
:
'
Sortable computed 3
'
},
{
name
:
'
Filtered computed 4
'
},
{
name
:
'
Sortable computed 5
'
},
{
name
:
'
Filtered computed 6
'
}];
var
sortableObservableItems
=
[{
name
:
'
Sortable observable 1
'
},
{
name
:
'
Sortable observable 2
'
},
{
name
:
'
Sortable observable 3
'
}];
var
sortableObservableItems
=
[{
name
:
'
Sortable observable 1
'
},
{
name
:
'
Sortable observable 2
'
},
{
name
:
'
Sortable observable 3
'
}];
var
draggableComputedItems
=
[{
name
:
'
Draggable computed 1
'
},
{
name
:
'
Draggable computed 2
'
},
{
name
:
'
Draggable computed 3
'
}];
var
draggableComputedItems
=
[{
name
:
'
Draggable computed 1
'
},
{
name
:
'
Draggable computed 2
'
},
{
name
:
'
Draggable computed 3
'
}];
...
@@ -113,7 +113,12 @@
...
@@ -113,7 +113,12 @@
underlayingDraggableComputedItems
:
ko
.
observableArray
(
draggableComputedItems
),
underlayingDraggableComputedItems
:
ko
.
observableArray
(
draggableComputedItems
),
draggableObservableItems
:
ko
.
observableArray
(
draggableObservableItems
)
draggableObservableItems
:
ko
.
observableArray
(
draggableObservableItems
)
}
}
vm
.
sortableComputedItems
=
ko
.
computed
(
function
()
{
return
vm
.
underlayingSortableComputedItems
();
});
vm
.
sortableComputedItems
=
ko
.
computed
(
function
()
{
return
vm
.
underlayingSortableComputedItems
()
.
filter
(
function
(
item
)
{
return
item
.
name
.
indexOf
(
'
Filtered
'
)
<
0
;
});
});
vm
.
draggableComputedItems
=
ko
.
computed
(
function
()
{
return
vm
.
underlayingDraggableComputedItems
();
});
vm
.
draggableComputedItems
=
ko
.
computed
(
function
()
{
return
vm
.
underlayingDraggableComputedItems
();
});
ko
.
applyBindings
(
vm
);
ko
.
applyBindings
(
vm
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录